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 / Making something go towards a certain point and then detect collision

Author
Message
leemr
5
Years of Service
User Offline
Joined: 28th Nov 2018
Location:
Posted: 28th Nov 2018 01:42
So lets say I want a sprite to go to (100, 1000) and then when it reaches that point, it detects if there is anything there. If there is, then
randomvariable = randomvariable + 1
happens. How exactly would I do this? I like to look at code, and learn what the person did, so it would be nice if someone could write the code, since I am new. Sorry if my english is bad.
TomToad
6
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 28th Nov 2018 11:12
There is a good example of moving sprites using tweens in the gelp files under SetTweenSpriteX() commandhttps://www.appgamekit.com/documentation/Reference/Tweening/SetTweenSpriteX.htm.

To check if two sprites collide, you can use the command GetSpriteCollision() https://www.appgamekit.com/documentation/Reference/Sprite/GetSpriteCollision.htm
If you are not checking against another sprite, but some logical location instead, then you could use GetSpriteInBox or GetSpriteInCircle.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Nov 2018 16:47



Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 6th Dec 2018 03:05 Edited at: 6th Dec 2018 03:22
Bit of code to demonstrate:



PSY LABS Games
Coders don't die, they just gosub without return

Login to post a reply

Server time is: 2024-04-23 20:45:12
Your offset time is: 2024-04-23 20:45:12