Computer Science Canada

cant figure out how to move my image with out it dragging

Author:  ShockingRotom [ Thu Oct 04, 2018 8:12 pm ]
Post subject:  cant figure out how to move my image with out it dragging

whenever the image moves it drags and leaves multiple versions of itself. How do i fix this? here is the part of my code that i am having problems with.


%I set the location
blockx := 300
blocky := 190
loop
%draw my background
Pic.Draw (start,0,0, picCopy)
Pic.Draw (genderblock,blockx,blocky, picCopy)
%draw the image that i want to move before because it is my character
Mouse.Where (x, y, button)
if button = 1 and x >= 280 and x <= 360 and y >= 325 then
%this checks when i click the arrow to the next room. after this i want it to play the animation of the character moving over to the exit which is straight ahead
loop
Pic.Draw (genderblock,blockx,blocky, picCopy)
%i draw it again in the loop so it moves (I know that even after i fix the dragging there will be a problem with the first image drawn outside the loop but i first want to figure out this
blocky += 1
%I add to the y so it moves up
delay (10)
if blocky = 370 then
%this is the end of the room so i want it so exit the loop and move on.
exit
end if
end loop
exit
end if
end loop

Author:  Insectoid [ Sat Oct 06, 2018 11:07 am ]
Post subject:  RE:cant figure out how to move my image with out it dragging

You aren't moving the picture, you're drawing it again in a different spot. The old image needs to be erased before the new one is drawn.


: