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 / Jump without physics problem

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Sep 2015 17:25
Hi.

I have this code for jump without physics. this code work very well but I can't stop falling after collide with ground or when PlayerY is 87.

please guide me to fix it.

SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 25th Sep 2015 20:01
Try this but have a look through the links above as they are quite informative.




The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Sep 2015 20:24
thanks spectrepaul
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 25th Sep 2015 21:34 Edited at: 25th Sep 2015 21:34
Just had another look as I am interested in this myself doing a platform game and I am going to be doing my own system and platform detection etc.

Look at this code:



Notice the slight change?

Instead of using collision it uses points on the sprites, only changed it basic but if you do six points like the links you can get a better system going.

If you see it lands on the floor better doing this.

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 25th Sep 2015 21:47 Edited at: 25th Sep 2015 21:54
Thanks spectrepaul for fix problem.

I fixed it with this code.

Crazy Programmer
AGK Developer
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 25th Sep 2015 23:36 Edited at: 26th Sep 2015 06:30
Quote: "I fixed it with this code."

That's only going to work if your ground is always at the same height. Once you start getting into changing your landscape...It wont work

My idea would be to create a function to determine the Players points of contacts with Grounds[SpriteID]

Using GetSpriteHeight(Grounds[SPriteID]) and GetSpriteWidth(Grounds[SPriteID])

Your going to need to get the width and height of all the ground sprites to determine where the bounds start and end. Also you will need the Sprites Position GetSpriteXPos and GetSpriteYPos

^ This is all just a theory and it has me interested in creating an example. I will get back to you

Edit: I sort of got it to work...Its nothing worth sharing...I might have another go at it some time later.

Ill just go ahead and share it You never know someone might chime in tell me the actual way to do it




This is only checking to see if the sprite is in contact with the top of each Ground sprite.



^ this is what I am worried about....Something about it just feels wrong...Too many ands...

Move around with the arrow keys (Up,Right,Left,Down)

Beta Test Age of Knights:https://play.google.com/apps/testing/com.CrazyProgrammerProductions.my_AgeOfKnights
Download JellyFish Dive:https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_JellyFishSwim

Login to post a reply

Server time is: 2024-04-20 08:22:50
Your offset time is: 2024-04-20 08:22:50