From c437b07b036ac2f5917405cab024b53e0393f40b Mon Sep 17 00:00:00 2001 From: trans_soup <> Date: Fri, 27 Oct 2023 15:40:23 +0200 Subject: [PATCH] allow for levels to change player & goal sizes. --- js/goal.mjs | 5 +++++ js/player.mjs | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/js/goal.mjs b/js/goal.mjs index 940fdb4..7a6c6db 100644 --- a/js/goal.mjs +++ b/js/goal.mjs @@ -32,9 +32,14 @@ Event.listen("level/load/goal", (data = {}) => { x: 0, y: 0, }, + size: { + x: 40, + y: 40, + }, }); Entity.set_pos(goal, data.pos.x, data.pos.y); + Entity.set_size(goal, data.size.x, data.size.y); Entity.set_visible(goal, true); Entity.set_physical(goal, true); diff --git a/js/player.mjs b/js/player.mjs index d741fad..b504481 100644 --- a/js/player.mjs +++ b/js/player.mjs @@ -11,9 +11,7 @@ import { underride } from "./underride.mjs"; const player = Entity.create(0, 0, 20, 20); -export function get_player () { - return player; -} +export function get_player () { return player; } function tick_player (deltatime) { const meta = Entity.get_meta(player); @@ -43,10 +41,15 @@ Event.listen("level/load/player", (data = {}) => { x: 0, y: 0, }, + size: { + x: 20, + y: 20, + }, speed: 100, }); Entity.set_pos(player, data.pos.x, data.pos.y); + Entity.set_size(player, data.size.x, data.size.y); const meta = Entity.get_meta(player);