Computer Science Canada Help with repeating |
Author: | adrian123 [ Tue Jan 17, 2012 7:01 pm ] | ||
Post subject: | Help with repeating | ||
What is it you are trying to achieve? Have blocks (bullet bill images) continually travel from right to left What is the problem you are having? When I run the program, the image only "shoots" to the other side once, and never repeats it. Can anyone tell me how to make it so that I can make a bulletbill object continually look like it is being launched from one side to another? Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using <4.1> |
Author: | Dreadnought [ Tue Jan 17, 2012 8:54 pm ] |
Post subject: | Re: Help with repeating |
Well, lets say you want it to repeat when it goes off the screen on the left. The easiest way is to check if the bullet-bill is offscreen (check the x position), and if so, set its x position back to what it was initially. |
Author: | adrian123 [ Tue Jan 17, 2012 9:34 pm ] |
Post subject: | Re: Help with repeating |
Dreadnought @ Tue Jan 17, 2012 8:54 pm wrote: Well, lets say you want it to repeat when it goes off the screen on the left. The easiest way is to check if the bullet-bill is offscreen (check the x position), and if so, set its x position back to what it was initially.
ok so i tried that and it looks like this Pic.Draw (bulletbill , bulletbillx , bulletbilly , picMerge) bulletbillx := bulletbillx -5 if bulletbillx <= -1 then bulletbillx:=900 end if Now how would I make it so that when it resets to the maxx it will make it go off from a different y value? |
Author: | Aange10 [ Tue Jan 17, 2012 10:23 pm ] | ||
Post subject: | Re: Help with repeating | ||
adrian123 @ 17/1/2012, 8:34 pm wrote: Dreadnought @ Tue Jan 17, 2012 8:54 pm wrote: Well, lets say you want it to repeat when it goes off the screen on the left. The easiest way is to check if the bullet-bill is offscreen (check the x position), and if so, set its x position back to what it was initially.
ok so i tried that and it looks like this Pic.Draw (bulletbill , bulletbillx , bulletbilly , picMerge) bulletbillx := bulletbillx -5 if bulletbillx <= -1 then bulletbillx:=900 end if Now how would I make it so that when it resets to the maxx it will make it go off from a different y value? How do you make it go off from the current y value? Okay, now how do you change that value?
|