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 Classic Chat / Collision on scrolling background

Author
Message
sskethan
15
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 8th Dec 2012 17:48
Currently my player will stop when colliding with the object but the background continues to scroll. My question is how would i get the background to stop as well?
Thank you for any help you can give.

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 8th Dec 2012 18:06 Edited at: 8th Dec 2012 18:09
You have to set "1" in a "IfCollisionVar" variable in your "if(collision)" statement and verify this variable before updating background/floor position

Keep in mind that you have to set the IfCollisionVar to "0" in the else statement of your collision check
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Dec 2012 18:09
Add another setspriteposition command for your floor inside the if expression for the collision test to adjust it as well as your player sprite.

That is the first thing that comes to mind.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 8th Dec 2012 18:28 Edited at: 8th Dec 2012 18:30
Add another setspritepos ? maybe he can only move the line



into the else collision statement :





There is a lot of solutions
sskethan
15
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 8th Dec 2012 19:50
Thank you for the help, but when i try this the player then passes through the object at a faster speed.
http://www.youtube.com/watch?v=4wa_u3og1kg
I have been trying other combinations but the best result i get is when the player teleports back to 0,0
setspriteposition ( 2, getspritex ( 1 ) - ( mx# / .40 ), getspritey ( 1 ) - ( my# / .40 ) )
I think this could work if i could figure out how to get the player to move back to the last position he was in when the collision happened.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 8th Dec 2012 19:53 Edited at: 8th Dec 2012 19:56
you should check collisions AFTER calculation of New position X and Y and BEFORE updating your player sprite and check collision With New calculated coords. Then, apply the new coords to your player (and update your background) ONLY if no collision.

You have to move up your collision check statement ...
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Dec 2012 20:28
I think MikeMax has the best solution.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 8th Dec 2012 20:58



(other subject : AncientLady ? did you achieve to compile the 1085b android player ?)

(A real forum tchat is missing here ... other than external ones like IRC etc ...)
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Dec 2012 22:08
Quote: "did you achieve to compile the 1085b android player "

Not yet, I've been way too busy with other things. And I now have to start making my Holiday Curry packets (my curry powder, hot and mild, for thirty people).

I'll try to get it done next week.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
sskethan
15
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 15th Dec 2012 15:53
Sorry, I was out for a bit. Thank you for the help. I got it now. What i did was:

change the - to + and all is good.

Login to post a reply

Server time is: 2024-04-27 20:38:47
Your offset time is: 2024-04-27 20:38:47