how upwarps/downwarps work
4 years ago
United States

ok so here's the code for vertical collision:

if place_meeting(x, (y + vspeed_), objCollision) { while (!place_meeting(x, (y + sign(vspeed_)), objCollision)) y += sign(vspeed_) vspeed_ = 0 vspd = 0 }

basically:

  1. If beemis is about to collide with anything (vertically),
  2. While beemis wouldn't collide with the collision on the next frame: 2a. Move him in the direction of the direction he was going in
  3. Once 2 is done, reset speed this essentially just moves beemis exactly, to the pixel, next to the object.

or, even more basically: If beemis is about to collide with anything (vertically), move him to the closest collision in the direction he was traveling in.

(what i think) The reason downwarps work is: Beemis is colliding with an object above him, but is already traveling down, or away from the obstacle. However, the loop still runs, and beemis actually travels further than the collision downward, bringing him to the nearest collision downward. something similar happens for upwarps

Estatísticas do jogo
Seguidores
10
Corridas
66
Jogadores
7
Últimos tópicos
Postado 4 years ago
0 resposta
Postado 5 years ago
0 resposta
Postado 5 years ago
0 resposta
Postado 5 years ago
1 resposta