esplonky Posted February 15, 2012 Share Posted February 15, 2012 (edited) I want to make a ball appear at a random time in a random place, then disappear once the player0 touches and then repeat. right now, i have an affixed time and place for the ball to appear by doing this: f = f + 1 if f = 100 then ballx = 47 if f = 100 then bally = 35 if collision(player0,ball) then f = 0 if f = 0 then ballx = 200 if f = 0 then bally = 200 how do I: 1. make it take longer to appear 2. randomize location without it going out of bounds 3. make it make the player move faster for 5 seconds after it was touched Edited February 15, 2012 by esplonky Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted February 15, 2012 Share Posted February 15, 2012 That sounds like Chase It (the link is in my sig), though I don't have numbers one and three for options. 1 Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted February 15, 2012 Share Posted February 15, 2012 (edited) Time in seconds are variables of 60. For example: 2 seconds would be 120, 3 seconds would be 180, and 4 seconds would be 240. (bB numbers don't go above 255.) It depends on how long you would want it to appear. For more than 5 seconds, you could do this (which would have to use another variable): g=g+1 if g>59 then g=0 : f=f+1 if f=6 then f=0 : ballx=(rand/2)+20 : bally=(rand/4)+20 The above code is for 6 seconds. For five seconds, you would just reduce the part "if f=6" to "if f=5". To make it make the player move faster after it was touched, you could do something like this: if collision(player0,ball) then j{0}=1 : bally=100 : h=1 else h=2 : j{0}=0 i=i+1 if i>h && joy0left && player0x>20 then player0x=player0x-1 if i>h && joy0right && player0x<140 then player0x=player0x+1 if i>h && joy0up && player0y>20 then player0y=player0y-1 if i>h && joy0down && player0y<88 then player0y=player0y+1 if i>h then i=0 Edited February 15, 2012 by atari2600land 1 Quote Link to comment Share on other sites More sharing options...
esplonky Posted February 15, 2012 Author Share Posted February 15, 2012 Sweet thanks guys!!! Quote Link to comment Share on other sites More sharing options...
esplonky Posted February 17, 2012 Author Share Posted February 17, 2012 that just made my player move fast always, and it should be temporary speed up too Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.