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.

AppGameKit Classic Chat / SetSpriteVisible Problem

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 19:48 Edited at: 5th Dec 2014 19:49
Hi.

I wrote a code with for loop that create two Column sprites (as coin). now I check collision between the player and coins. then I want if collision is true, hide coins. but there is an Problem that when I collide to coin sprite, only one coin hide.Please Guide me for fix this Problem.

this is my code:

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 20:18 Edited at: 5th Dec 2014 20:21
I could fix this Problem with check collision like below code, but there is another clear way?



also I change top code to this but only hide one sprite

Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 5th Dec 2014 20:23
Your collision code is outside of the loop so you are only checking one Diamond[]
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 20:27 Edited at: 5th Dec 2014 20:55
my collision code is between do---loop.

this is another my code that check collision with for loop but give me this error:

Subscript is out of bounds at line 28

all things seem ok but don't know why can understand Diamond(i) at line 28.

fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 5th Dec 2014 21:40 Edited at: 5th Dec 2014 21:41
it should be
and not


Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 21:43
Yes, Thanks fog
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Dec 2014 22:12
What value is i supposed to be? You finished the i loop and then used i as an index outside the loop.

-- Jim - When is there going to be a release?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 6th Dec 2014 06:23
Quote: "You finished the i loop and then used i as an index outside the loop."


yes, I Mistake.

Login to post a reply

Server time is: 2024-11-25 13:32:29
Your offset time is: 2024-11-25 13:32:29