Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Graysire
12
Years of Service
User Offline
Joined: 18th Oct 2013
Location:
Posted: 14th Nov 2013 19:15
NumberOfFruits = 120
FruitColor = 0
for t = 1 to NumberOfFruits

if FruitColor = 0
r = 102
endif
if FruitColor = 1
r = 103
endif
if FruitColor = 2
r = 104
endif
if FruitColor = 3
r = 105
endif
FruitColor = FruitColor + 1
if FruitColor = 4 then FruitColor = 0

make object sphere t + NumberOfFruits ,50
texture object t + NumberOfFruits , r
position object t + NumberOfFruits ,Rnd(1900)-950,30,Rnd(1900)-950
make object collision box t + NumberOfFruits ,-25,-25,-25,25,25,25,0
next t
this is the code that generates spheres



for t = 1 to NumberOfFruits : rem If I hit one of the little fruits
if Object collision(1,t + NumberOfFruits)>0
play sound 4
MyScore = MyScore + 100 : rem How many points each little fruit is worth
MyScore2=MyScore2+ 100

` delete object t + NumberOfFruits
exclude object on t + NumberOfFruits
endIf
next t
this is their collision


what can i add to make them respawn when you collide with them?
Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 15th Nov 2013 18:13 Edited at: 15th Nov 2013 18:16
If you just want them to 'disappear' and then respawn in random places then just randomly reposition them when a collision is detected:

if Object collision(1,t)>0
position object t,Rnd(1900)-950,30,Rnd(1900)-950




D.D.
Graysire
12
Years of Service
User Offline
Joined: 18th Oct 2013
Location:
Posted: 15th Nov 2013 19:30
thanks that really helped after i sorted out accidently changed variables.

Login to post a reply

Server time is: 2026-07-07 05:39:13
Your offset time is: 2026-07-07 05:39:13