Skip to content

Commit

Permalink
amap: make some colisions less weird
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
cosmo-ray committed Nov 3, 2024
1 parent 18785f0 commit f754e26
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions modules/amap/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,11 @@ function amap_action(wid, events)
objs.rm(idx)
}
} else if (ctype == TYPE_BREAKABLE_BLOCK) {
stop_x = true
if ((ywPosY(old_pos) + SPRITE_SIZE) <= ywPosY(ywCanvasObjPos(c))) {
let obj_pos = ywCanvasObjPos(c)
if (ywPosY(old_pos) <= ywPosY(obj_pos) + ywCanvasObjSize(wid, c)) {
stop_x = true
}
if ((ywPosY(old_pos) + SPRITE_SIZE) <= ywPosY(obj_pos)) {
stop_fall = true
}
if (pc_canel.geti(PC_DROPSPEED_IDX) < 0)
Expand All @@ -838,13 +841,18 @@ function amap_action(wid, events)
}
return false;
} else if (ctype != TYPE_ANIMATION && ctype != TYPE_PUNCH) {
if ((ywPosY(old_pos) + SPRITE_SIZE) <= ywPosY(ywCanvasObjPos(c))) {
let obj_pos = ywCanvasObjPos(c)

if ((ywPosY(old_pos) + SPRITE_SIZE) <= ywPosY(obj_pos)) {
stop_fall = true
} else if (ctype != TYPE_LIGHT_FLOOR &&
(wid.geti("#-yblock") > 0 || yeGetIntAt(pc_canel, PC_DROPSPEED_IDX) >= 0) &&
(ywPosY(old_pos) + SPRITE_SIZE - 1) >
ywPosY(ywCanvasObjPos(c)) + 10) {
stop_x = true
ywPosY(obj_pos) + 10) {

if (ywPosY(old_pos) <= ywPosY(obj_pos) + ywCanvasObjSize(wid, c)) {
stop_x = true
}
if (wid.geti("#-yblock") > 0 && pc_canel.geti(PC_DROPSPEED_IDX) < 0) {
pc_canel.setAt(PC_DROPSPEED_IDX, 0)
}
Expand Down

0 comments on commit f754e26

Please sign in to comment.