I want to make a 2D Third Person Platformer like this.
But im struggling on how to jump from one place to that place
I want to make a 2D Third Person Platformer like this.
@Johan_Sipili Making a platformer can be hard, but I have an example that you can use. Feel free to use any of the code. platformer example6-28-2024_10-40-39.wick (7.4 KB)
Thanks! but please look at the picture, the views are different
The photo is a Birds eye view but I think Im able to work with your code
Off topic but I just realized from your code its from I no longer believe in gravity post and I have been putting the update part of your frame into my characters Update script
I lied to myself
I have also found a glitch with ONLY my character I made for my game
platformer example2 I have no idea whats wrong with it but this glitch only happened with that character i made. Nothing else.
See for yourself and youll know what i mean
Oh. Sorry
I hope someone comes and helps me fix this, this is a major problem for my game
I dont think its your problem, I know where the gravity comes from
I think its the code? or the stickman drawing i made?
Please someone help.
I see the error.
It’s because this gravity system works based on the y value and height of the player— which are constantly changing in your player since it’s changing frames.
Allow me to demonstrate— assume this gray box is the player.
The code will use the height and the y-value of the middle point
And the code will set the y-value of the player to be above the ground by half of the player’s height. That way, it’ll look like the player is on the floor.
Now—
To understand why this glitch happened, we’ll take a look at your character.
Below, I marked the y-value and the height of your player.
Now, notice when I take half of the height, it goes a bit over the y-value?
In other words, if I tried adding half of the height to lift the player off of the floor, it’ll end up actually floating, like this:
And when it’s floating, it’s not touching the floor, so it will fall again. Then it’ll touch the ground, and end up floating again. Then fall again. Then float. Then fall. Then float. Then… you get the idea.
This is because everything inside of the clip’s timeline is not centered…
Not to mention that every one of your animation frames will give the character a different size.
So, it may seem a bit complicated now… you might be wondering how to solve this?
Well, you have two solutions.
Go inside of your clip’s timeline, and just add a huge box. This will count as a hitbox for the collision.
You can make the opacity of the box zero to hide it. You also want to make sure that the y value of this box is zero. You can move your player up and down, make the box smaller or bigger, but keep the y value of the box zero and and keep the player inside of it.
You can take the animation, the player, and make them two separate clips!
This would probably be the better solution.
What you’re doing here is putting all the gravity code inside of a simple box, and putting all of the animation code inside of another clip, then you’ll just need to tell the code to set the x and y values of the animation to the x and y values of the player clip.
Here’s an example click me for wick file (85.3 KB)
What’s nice about this method is you can resize the player as you wish and do whatever you want with the animation, and since they’re separate clips, what you do in one won’t affect the other. This also makes it way easier to replace the animation with another animation if you wanted to pick a different character.
I remember writing the I no Longer Believe in Gravity code around 3 years ago, that was around the time I started learning to code so the whole gravity code stuff is not perfect … but it’s a very easy and simple gravity system to understand! So you can keep using it, though if you’d like a more perfect collision system, I’d recommend trying out Baron’s Platformer engine
Thanks! (ten letters)