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 / Side scrolling with physics on

Author
Message
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 19th Mar 2020 00:46
Questions
1) what’s the best way to control a sprite with physics on? SetSpritePosition() seems to be very slow
2) what’s the best way to check for collision based on certain tiles? Right now I coded it to check for specific image ids
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Mar 2020 01:03
1) If your sprite is a physics object you cannot move it using SetSpitePosition() you need to use impulse/velocity/force commands
2) In order to turn on off collision with tiles you could change the sprites collision group. ie. when you jump up, change the collision group, when you fall set it back (so you can move through tiles)
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 19th Mar 2020 03:07
Good ideas. If I want to move sprite with physics at a constant speed, couldn’t I use setSpriteX() ?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Mar 2020 03:40
Quote: " If I want to move sprite with physics at a constant speed, couldn’t I use setSpriteX() "


No. The only way to move a sprite (That has physics enabled) is through force/impulse/velocity

If you want to use SetSpriteX() then implement the movement/collision outside of physics. There is not a lot to it. It's pretty straight forward
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 19th Mar 2020 04:17
Thanks. It’s pretty fun messing physics. I had AppGameKit classic for a while and never messed with physics until now. Wow, I checked the command list and there are tons of functions for physics.

Login to post a reply

Server time is: 2024-03-29 09:09:03
Your offset time is: 2024-03-29 09:09:03