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 Studio Chat / Accesing Sprite positions as in the scene editor?

Author
Message
Amon
9
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 26th Mar 2019 23:02
I move a sprite into the scene and give it a unique variable called ship. My scene is called GameScene. In code I access the ship sprite ID by using GameScene_ship. How do I access the position of the ship? I tried GetSpriteX(GameScene_ship) but it throws an error saying "sprite 0 does not exist in main.agc"
Imaginations' greatest gift is the knowledge you supply it.
ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 27th Mar 2019 02:23
Make sure you're running GameScene_setup() before using GameScene_ship. This will make sure the sprite is created and assigned to the variable.
Amon
9
Years of Service
User Offline
Joined: 30th May 2014
Location: Shropshire, United Kingdom
Posted: 27th Mar 2019 10:35
Oops.
Imaginations' greatest gift is the knowledge you supply it.

Login to post a reply

Server time is: 2024-03-28 11:03:10
Your offset time is: 2024-03-28 11:03:10