Yo! I’m making an RPG in MakeCode Arcade with a fake 2.5D jumping system. My jump works by storing a separate Z value (Crashton.Z) and every frame I set:
sprite.y = groundY - Z
Gravity and jumping both work correctly.
The problem is with tilemap collisions. Horizontal wall collisions work, walking downward into walls or landing on wall corners causes jitter and sometimes lets the player clip through, and if I completely remove the line that sets sprite.y = groundY - Z, the collision bug disappears and walls behave perfectly. It seems like manually setting the sprite’s Y every frame is interfering with the collision engine.
Is this a known limitation of Arcade, or is there a better way to implement this kind of fake Z-axis while still using tilemap walls?
it sounds like you need your own player system (half joke)
Definitely send the code, but I think that code you have that sets the position is making it clip through walls. maybe put that code in that block at the end of arcade-sprite-util with after and update controller sprites
If I remove that line, wall collisions work perfectly. With it enabled, horizontal collisions are perfectly fine, but vertical collisions jitter and I can sometimes clip through when moving downward or landing from a jump.
Imma be honest, I really dunno wut you mean. But my code is making it seem and look like the player is jumping, not physically moving moving upward if that makes sense.
@Crashton_Powerstone rather than doing your own physics, i recommend just using the arcade physics engine. i think your code is overcomplicating things a bit. that being said, the problem here is probably the animations you have on the character.
arcade bases the tilemap hitbox of a sprite based on the the filled in pixels of the sprite’s image. that means that animations can change the size of the hitbox if one frame has more transparent pixels than another. this is usually what causes jitter like this in tilemap collisions.
the easiest way to fix this is to create two sprites for your player character instead of one.
here’s some example code that demonstrates what i mean:
note the sprite on the right, it’s jittering because its animation is changing the hitbox size.
the sprite on the left doesn’t jitter because it is actually two sprites: one is a rectangle that doesn’t animate and the other is the sprite you see. all of the physics, overlaps, etc. are done on the non-animating sprite (it also has the invisible flag set so that the player doesn’t see it). the animating sprite has the ghost flag set so that it ignores tilemap collisions and i use an on game update to make sure that its position is always the same as the non-animating sprite.
that code has comments that explain what it’s doing. check it out!