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.

Newcomers AppGameKit Corner / Curious about Sprite Movement after Collision

Author
Message
AdamRyan
6
Years of Service
User Offline
Joined: 13th Dec 2017
Location:
Posted: 9th Feb 2018 16:18
TLR; Why does a sprite stop moving after its been 'hit'?

This is obviously a good thing, but what is happening under the hood?

so if i have this:



the sprite moves, but when there is a collision this is triggered (is it wrong/lazy btw?)



AND as well as being off screen it stops moving (a good thing), but the move code IS STILL IN the loop for the spriteID, but has no effect. Why? (Just trying to learn!)

PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 10th Feb 2018 01:33 Edited at: 10th Feb 2018 01:34
I'm afraid you're not giving us enough code to work with here. Most likely the issue is with an 'if' or 'while' statement that remains true after you have changed the position to -1000 and -1000 and therefore continues to skip the movement code.

I am pretty sure the example project Bubbles_with_types should give you an idea on how to tackle this particular problem;

IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 10th Feb 2018 06:43
Are you calling SetSpritePosition(spriteID,-1000,-1000) repeatedly?
AdamRyan
6
Years of Service
User Offline
Joined: 13th Dec 2017
Location:
Posted: 10th Feb 2018 08:32
Thx guys!

I realise that I was mistaken about what was happening. I presume that the sprites DO continue to move unless i add an 'alive' keyvalue pair for example (as per the video). Thanks Phemox!

@ironmanhood, i dont quite do exactly that setPosition but similar. Is it wrong?
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 10th Feb 2018 10:34
It depends on what code you have and what you are trying to accomplish. If it seems to be working as intended then something must be correct.

Login to post a reply

Server time is: 2024-11-21 19:58:19
Your offset time is: 2024-11-21 19:58:19