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 / FixSpriteToScreen help

Author
Message
marioman68
9
Years of Service
User Offline
Joined: 2nd Aug 2015
Location:
Posted: 2nd Aug 2015 07:08
i have a player sprite set using FixSpriteToScreen and a enemy sprite set in the world, but i cant the enemy to follow the player or even just get the x or y coordinates of the enemy sprite it just stays at 0. what command is used to bring the enemy sprite to the world coordinates. thanks for any help and if need any more info let me know.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Aug 2015 10:49
When you FixSpriteToScreen it's like creating a second world. It is intended for GUI elements, such as high score or health. I've never seen a technique that involves mixing player and enemies using the 2 different coordinate systems.

If you want to scroll the screen but keep the player in place, then you simply need to offset the player's position in the same way you offset the screen coordinates.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
marioman68
9
Years of Service
User Offline
Joined: 2nd Aug 2015
Location:
Posted: 2nd Aug 2015 17:28
thank you so much. i read places to fix the sprite to the screen but just doing the offset worked like a charm.

Login to post a reply

Server time is: 2024-11-21 20:23:34
Your offset time is: 2024-11-21 20:23:34