Skip to content

Commit

Permalink
amap: more option for pc
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
cosmo-ray committed Sep 16, 2024
1 parent 52d5ffc commit 5db0b20
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions modules/amap/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,14 @@ function amap_action(wid, events)
yeSetIntAt(pc_canel, PC_DIR, DIR_LEFT)
y_move_set_xspeed(pc_minfo, -BASE_SPEED)
wid.setAt("keydown", wid.geti("keydown") | KEYDOWN_LEFT)
pc_handler.setAt("flip", 1)
let flip_val = wid.geti("pc_revers_flip")
pc_handler.setAt("flip", 1 - flip_val)
} else if (yevIsKeyDown(events, Y_RIGHT_KEY) && have_upkey != DIR_RIGHT) {
yeSetIntAt(pc_canel, PC_DIR, DIR_RIGHT)
wid.setAt("keydown", wid.geti("keydown") | KEYDOWN_RIGHT)
y_move_set_xspeed(pc_minfo, BASE_SPEED)
pc_handler.setAt("flip", 0)
let flip_val = wid.geti("pc_revers_flip")
pc_handler.setAt("flip", 0 + flip_val)
} else if (yevIsKeyDown(events, Y_C_KEY) && yeGetIntAt(pc_canel, PC_DASH) == 0) {
let dir = 1
y_move_set_xspeed(pc_minfo, BASE_SPEED)
Expand Down Expand Up @@ -1064,7 +1066,13 @@ function amap_init(wid)
if (wid.get("pc-sprites") != null) {
ygModDirOut()
for (s of wid.get("pc-sprites")) {
ywTextureNewImg(yeGetString(s), null, txts_arrays, null)
if (yeType(s) == YSTRING) {
ywTextureNewImg(yeGetString(s), null, txts_arrays, null)
} else {
let img = s.gets(0)
let rect = s.get(1)
ywTextureNewImg(img, rect, txts_arrays, null)
}
}
ygModDir("amap")
} else {
Expand All @@ -1080,23 +1088,41 @@ function amap_init(wid)
if (wid.get("pc-jmp-sprites")) {
let jmp_array = yeCreateArray()
for (s of wid.get("pc-jmp-sprites")) {
ywTextureNewImg(yeGetString(s), null, jmp_array, null);
if (yeType(s) == YSTRING) {
ywTextureNewImg(yeGetString(s), null, jmp_array, null)
} else {
let img = s.gets(0)
let rect = s.get(1)
ywTextureNewImg(img, rect, jmp_array, null)
}
}
pc_handler.get("txts").push(jmp_array, "jmp")
}

if (wid.get("pc-dash-sprites")) {
let dash_array = yeCreateArray()
for (s of wid.get("pc-dash-sprites")) {
ywTextureNewImg(yeGetString(s), null, dash_array, null);
if (yeType(s) == YSTRING) {
ywTextureNewImg(yeGetString(s), null, dash_array, null)
} else {
let img = s.gets(0)
let rect = s.get(1)
ywTextureNewImg(img, rect, dash_array, null)
}
}
pc_handler.get("txts").push(dash_array, "dash")
}

if (wid.get("pc-punch-sprites")) {
let punch_array = yeCreateArray()
for (s of wid.get("pc-punch-sprites")) {
ywTextureNewImg(yeGetString(s), null, punch_array, null);
if (yeType(s) == YSTRING) {
ywTextureNewImg(yeGetString(s), null, punch_array, null)
} else {
let img = s.gets(0)
let rect = s.get(1)
ywTextureNewImg(img, rect, punch_array, null)
}
}
pc_handler.get("txts").push(punch_array, "punch")
}
Expand Down

0 comments on commit 5db0b20

Please sign in to comment.