From 166a487216e7d27a8cb2e221c90a092d26bcd0f7 Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 02:44:43 +0100 Subject: [PATCH 1/7] minigame interaction back --- source/entities/Minigame.hx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/source/entities/Minigame.hx b/source/entities/Minigame.hx index 44dea7f0..fff50694 100644 --- a/source/entities/Minigame.hx +++ b/source/entities/Minigame.hx @@ -27,17 +27,20 @@ class Minigame extends Interactable alpha = 0.5; } + var marked:Bool = false; public override function mark_target(mark:Bool) { - if (mark) - { - if (Ctrl.jjump[1]) - { - start_minigame(); - } - } - else + marked = mark; + } + + override function update(elapsed:Float) + { + super.update(elapsed); + if (!marked) + return; + if (Ctrl.jjump[1]) { + start_minigame(); } } @@ -47,4 +50,4 @@ class Minigame extends Interactable MinigameHandler.instance.playMinigame(minigame_id); } -} \ No newline at end of file +} From 35353b593911440de2b8b70c284091cb45428343 Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 14:50:20 +0100 Subject: [PATCH 2/7] use action button for inteactions instead of jump. Make sure presents can be opened, and minigame launched --- assets/data/levels/TankmasLand.ldtk | 6 +- .../levels/TankmasLand/hotel_courtyard.ldtkl | 30 +++-- source/entities/Interactable.hx | 25 ++-- source/entities/Minigame.hx | 8 +- source/entities/NPC.hx | 8 +- source/entities/Player.hx | 29 +++-- source/entities/Present.hx | 35 +++--- source/states/PlayState.hx | 116 +++++++++++------- 8 files changed, 158 insertions(+), 99 deletions(-) diff --git a/assets/data/levels/TankmasLand.ldtk b/assets/data/levels/TankmasLand.ldtk index adafe22e..c0baf2d0 100644 --- a/assets/data/levels/TankmasLand.ldtk +++ b/assets/data/levels/TankmasLand.ldtk @@ -640,7 +640,7 @@ "maxWidth": null, "minHeight": 64, "maxHeight": null, - "keepAspectRatio": false, + "keepAspectRatio": true, "tileOpacity": 1, "fillOpacity": 1, "lineOpacity": 1, @@ -656,8 +656,8 @@ "maxCount": 0, "limitScope": "PerLevel", "limitBehavior": "MoveLastOne", - "pivotX": 0, - "pivotY": 0, + "pivotX": 0.5, + "pivotY": 0.5, "fieldDefs": [ { "identifier": "ActivityType", diff --git a/assets/data/levels/TankmasLand/hotel_courtyard.ldtkl b/assets/data/levels/TankmasLand/hotel_courtyard.ldtkl index b20e4510..09383c7e 100644 --- a/assets/data/levels/TankmasLand/hotel_courtyard.ldtkl +++ b/assets/data/levels/TankmasLand/hotel_courtyard.ldtkl @@ -325,21 +325,37 @@ { "px": [0,2144], "src": [32,0], "f": 0, "t": 1, "d": [6901], "a": 1 }, { "px": [3264,2144], "src": [32,0], "f": 0, "t": 1, "d": [7003], "a": 1 }, { "px": [0,2176], "src": [32,0], "f": 0, "t": 1, "d": [7004], "a": 1 }, + { "px": [1664,2176], "src": [0,0], "f": 0, "t": 0, "d": [7056], "a": 1 }, { "px": [3264,2176], "src": [32,0], "f": 0, "t": 1, "d": [7106], "a": 1 }, { "px": [0,2208], "src": [32,0], "f": 0, "t": 1, "d": [7107], "a": 1 }, + { "px": [1664,2208], "src": [0,0], "f": 0, "t": 0, "d": [7159], "a": 1 }, + { "px": [1696,2208], "src": [0,0], "f": 0, "t": 0, "d": [7160], "a": 1 }, { "px": [2112,2208], "src": [0,0], "f": 0, "t": 0, "d": [7173], "a": 1 }, { "px": [2144,2208], "src": [0,0], "f": 0, "t": 0, "d": [7174], "a": 1 }, { "px": [2176,2208], "src": [0,0], "f": 0, "t": 0, "d": [7175], "a": 1 }, { "px": [3264,2208], "src": [32,0], "f": 0, "t": 1, "d": [7209], "a": 1 }, { "px": [0,2240], "src": [32,0], "f": 0, "t": 1, "d": [7210], "a": 1 }, + { "px": [1696,2240], "src": [0,0], "f": 0, "t": 0, "d": [7263], "a": 1 }, + { "px": [1728,2240], "src": [0,0], "f": 0, "t": 0, "d": [7264], "a": 1 }, { "px": [2176,2240], "src": [0,0], "f": 0, "t": 0, "d": [7278], "a": 1 }, { "px": [2208,2240], "src": [0,0], "f": 0, "t": 0, "d": [7279], "a": 1 }, { "px": [2240,2240], "src": [0,0], "f": 0, "t": 0, "d": [7280], "a": 1 }, { "px": [0,2272], "src": [32,0], "f": 0, "t": 1, "d": [7313], "a": 1 }, + { "px": [1728,2272], "src": [0,0], "f": 0, "t": 0, "d": [7367], "a": 1 }, + { "px": [1760,2272], "src": [0,0], "f": 0, "t": 0, "d": [7368], "a": 1 }, { "px": [0,2304], "src": [32,0], "f": 0, "t": 1, "d": [7416], "a": 1 }, + { "px": [1760,2304], "src": [0,0], "f": 0, "t": 0, "d": [7471], "a": 1 }, + { "px": [1792,2304], "src": [0,0], "f": 0, "t": 0, "d": [7472], "a": 1 }, + { "px": [1824,2304], "src": [0,0], "f": 0, "t": 0, "d": [7473], "a": 1 }, { "px": [0,2336], "src": [32,0], "f": 0, "t": 1, "d": [7519], "a": 1 }, + { "px": [1824,2336], "src": [0,0], "f": 0, "t": 0, "d": [7576], "a": 1 }, + { "px": [1856,2336], "src": [0,0], "f": 0, "t": 0, "d": [7577], "a": 1 }, { "px": [0,2368], "src": [32,0], "f": 0, "t": 1, "d": [7622], "a": 1 }, + { "px": [1856,2368], "src": [0,0], "f": 0, "t": 0, "d": [7680], "a": 1 }, + { "px": [1888,2368], "src": [0,0], "f": 0, "t": 0, "d": [7681], "a": 1 }, { "px": [0,2400], "src": [32,0], "f": 0, "t": 1, "d": [7725], "a": 1 }, + { "px": [1888,2400], "src": [0,0], "f": 0, "t": 0, "d": [7784], "a": 1 }, + { "px": [1920,2400], "src": [0,0], "f": 0, "t": 0, "d": [7785], "a": 1 }, { "px": [0,2432], "src": [32,0], "f": 0, "t": 1, "d": [7828], "a": 1 }, { "px": [0,2464], "src": [32,0], "f": 0, "t": 1, "d": [7931], "a": 1 }, { "px": [0,2496], "src": [32,0], "f": 0, "t": 1, "d": [8034], "a": 1 }, @@ -587,22 +603,22 @@ }, { "__identifier": "Activity_Area", - "__grid": [76,128], - "__pivot": [0,0], + "__grid": [103,154], + "__pivot": [0.5,0.5], "__tags": [], "__tile": null, "__smartColor": "#484BFF", "iid": "d04eb910-9b00-11ef-a438-bf6fb7c2c1d9", - "width": 960, - "height": 832, + "width": 880, + "height": 880, "defUid": 24, - "px": [1216,2048], + "px": [1648,2464], "fieldInstances": [{ "__identifier": "ActivityType", "__type": "LocalEnum.ActivityType", "__value": "Bonfire", "__tile": null, "defUid": 26, "realEditorValues": [{ "id": "V_String", "params": ["Bonfire"] }] }], - "__worldX": 1248, - "__worldY": 2064 + "__worldX": 1680, + "__worldY": 2480 } ] }, diff --git a/source/entities/Interactable.hx b/source/entities/Interactable.hx index faf4f17c..033eee0a 100644 --- a/source/entities/Interactable.hx +++ b/source/entities/Interactable.hx @@ -3,10 +3,19 @@ package entities; import entities.base.NGSprite; class Interactable extends NGSprite -{ - public var detect_range:Int; +{ + public var detect_range:Int; public var interactable:Bool; + public var marked(default, set):Bool = false; + + function set_marked(m) + { + if (m != marked) + mark_target(m); + return marked = m; + } + public function new(?X:Float, ?Y:Float) { super(X, Y); @@ -33,12 +42,12 @@ class Interactable extends NGSprite return null; } - public function mark_target(mark:Bool) - throw "not implemented"; + function mark_target(mark:Bool) {} + + public static function unmark_all(interactables:FlxTypedGroup) + for (interactable in interactables) + interactable.marked = false; - public static function unmark_all(interactables:FlxTypedGroup) - for (interactable in interactables) - interactable.mark_target(false); override function kill() { PlayState.self.interactables.remove(this, true); @@ -51,4 +60,4 @@ enum abstract InteractableType(String) from String to String final NPC = "npc"; final PRESENT = "present"; final MINIGAME = "minigame"; -} \ No newline at end of file +} diff --git a/source/entities/Minigame.hx b/source/entities/Minigame.hx index fff50694..dd353c93 100644 --- a/source/entities/Minigame.hx +++ b/source/entities/Minigame.hx @@ -27,18 +27,12 @@ class Minigame extends Interactable alpha = 0.5; } - var marked:Bool = false; - public override function mark_target(mark:Bool) - { - marked = mark; - } - override function update(elapsed:Float) { super.update(elapsed); if (!marked) return; - if (Ctrl.jjump[1]) + if (Ctrl.jaction[1]) { start_minigame(); } diff --git a/source/entities/NPC.hx b/source/entities/NPC.hx index f0932dda..57df7356 100644 --- a/source/entities/NPC.hx +++ b/source/entities/NPC.hx @@ -10,8 +10,8 @@ class NPC extends Interactable public function new(?X:Float, ?Y:Float, name:String) { - super(X, Y); - + super(X, Y); + detect_range = 300; interactable = true; @@ -19,7 +19,7 @@ class NPC extends Interactable this.name = name; - PlayState.self.npcs.add(this); + PlayState.self.npcs.add(this); loadGraphic(Paths.get('${name}.png')); @@ -40,7 +40,7 @@ class NPC extends Interactable sprite_anim.anim(PresentAnimation.IDLE); case NEARBY: sprite_anim.anim(PresentAnimation.NEARBY); - if (Ctrl.jjump[1]) + if (Ctrl.jaction[1]) start_chat(); case CHATTING: sprite_anim.anim(PresentAnimation.IDLE); diff --git a/source/entities/Player.hx b/source/entities/Player.hx index 52619b19..1b22c99b 100644 --- a/source/entities/Player.hx +++ b/source/entities/Player.hx @@ -7,6 +7,7 @@ import entities.Interactable; import entities.base.BaseUser; import net.tankmas.NetDefs.NetUserDef; import net.tankmas.OnlineLoop; + class Player extends BaseUser { var move_no_input_drag:Float = 0.9; @@ -61,7 +62,7 @@ class Player extends BaseUser override function update(elapsed:Float) { - if (Main.DEV && Ctrl.any(Ctrl.jaction)) + if (Main.DEV && Ctrl.any(Ctrl.jaction) && !interact_in_use()) debug_rotate_costumes(); fsm(); @@ -125,13 +126,21 @@ class Player extends BaseUser { if (active_activity_area == null) return; - if (Ctrl.jjump[1]) + if (Ctrl.jaction[1]) { active_activity_area.on_interact(this); } } - var previously_closest_interactable:Interactable; + var active_interactable:Interactable; + + // returns true if either in an activity area, or if close to an interactable. + // If false, the use button can be used for other stuff + public function interact_in_use() + { + return active_activity_area != null || (active_interactable != null && active_interactable.interactable); + } + function detect_interactables() { // Disable interactions if in activity area @@ -142,16 +151,16 @@ class Player extends BaseUser } var closest:Interactable = Interactable.find_closest_in_array(this, Interactable.find_in_detect_range(this, PlayState.self.interactables)); - var target_changed = closest != previously_closest_interactable; + var target_changed = closest != active_interactable; - if (target_changed && previously_closest_interactable != null) + if (target_changed && active_interactable != null) { - previously_closest_interactable.mark_target(false); + active_interactable.marked = false; } if (closest == null) { - previously_closest_interactable = null; + active_interactable = null; return; } @@ -167,10 +176,10 @@ class Player extends BaseUser if (target_changed) { - closest.mark_target(true); + closest.marked = true; } - previously_closest_interactable = closest; + active_interactable = closest; } override function kill() @@ -178,6 +187,7 @@ class Player extends BaseUser PlayState.self.player = null; super.kill(); } + override function use_sticker(sticker_name:String):Bool { var sticker_got_used:Bool = super.use_sticker(sticker_name); @@ -202,7 +212,6 @@ class Player extends BaseUser if (last_update_json.y != y.floor() || force_send_full_user) def.y = y.floor(); - if (last_update_json.costume != costume.name || force_send_full_user) def.costume = costume.name; diff --git a/source/entities/Present.hx b/source/entities/Present.hx index 54aae49b..5dbed466 100644 --- a/source/entities/Present.hx +++ b/source/entities/Present.hx @@ -13,9 +13,11 @@ import states.substates.ComicSubstate; class Present extends Interactable { public var openable:Bool = true; + public static var opened:Bool = false; public var thumbnail:Thumbnail; + var content:String; var day:Int = 0; var comic:Bool = false; @@ -37,7 +39,7 @@ class Present extends Interactable day = Std.parseInt(presentData.day); type = Interactable.InteractableType.PRESENT; - + loadGraphic(Paths.get('present-$content.png'), true, 94, 94); PlayState.self.presents.add(this); @@ -75,34 +77,31 @@ class Present extends Interactable sprite_anim.anim(PresentAnimation.IDLE); case NEARBY: sprite_anim.anim(PresentAnimation.NEARBY); - if (Ctrl.jjump[1]) + if (Ctrl.jaction[1]) open(); case OPENING: sprite_anim.anim(PresentAnimation.OPENING); - case OPENED: + case OPENED: sprite_anim.anim(PresentAnimation.OPENED); + thumbnail.sstate("OPEN"); } override public function mark_target(mark:Bool) { - if (!opened) - { - if (mark && openable) - sstate(NEARBY); - if (!mark && openable) - sstate(IDLE); - } + if (!openable) + return; + + if (mark) + sstate(NEARBY); else + sstate(IDLE); + + if (mark /** && thumbnail.scale.x == 0**/) { - if (mark /** && thumbnail.scale.x == 0**/) - { - thumbnail.sstate("OPEN"); - if (Ctrl.jjump[1]) - open(); - } - else if (!mark /** && thumbnail.scale.x != 0 && thumbnail.state != "CLOSE"**/) - thumbnail.sstate("CLOSE"); + thumbnail.sstate("OPEN"); } + else if (!mark /** && thumbnail.scale.x != 0 && thumbnail.state != "CLOSE"**/) + thumbnail.sstate("CLOSE"); } override function updateMotion(elapsed:Float) diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 190774fa..0ae004d2 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -124,49 +124,79 @@ class PlayState extends BaseState if (Ctrl.reset[1]) FlxG.switchState(new PlayState()); - if (Ctrl.jaction[1]) + if (Ctrl.jaction[1] && !player.interact_in_use()) + new CostumeSelectSheet(); + if (Ctrl.jspecial[1]) new StickerSelectSheet(); - for (mem in ui.members) switch(ui.members.indexOf(mem)) - { - case 2: - var twen:FlxTween = null; - if(FlxG.mouse.overlaps(mem)) { - if(mem.y == 1030 && twen == null) - twen = FlxTween.tween(mem, {y: 880}, 0.3, {onComplete: function(twn:FlxTween) { - twen = null; - mem.loadGraphic(Paths.get('charselect_mini_FULL.png')); - }}); - if(FlxG.mouse.justReleased) { - if(twen != null) twen.cancel(); - twen = FlxTween.tween(mem, {y: 1180}, 0.3, {onComplete: (twn:FlxTween) -> { - new CostumeSelectSheet(); - twen = null; - }}); + for (mem in ui.members) + switch (ui.members.indexOf(mem)) + { + case 2: + var twen:FlxTween = null; + if (FlxG.mouse.overlaps(mem)) + { + if (mem.y == 1030 && twen == null) + twen = FlxTween.tween(mem, {y: 880}, 0.3, { + onComplete: function(twn:FlxTween) + { + twen = null; + mem.loadGraphic(Paths.get('charselect_mini_FULL.png')); + } + }); + if (FlxG.mouse.justReleased) + { + if (twen != null) + twen.cancel(); + twen = FlxTween.tween(mem, {y: 1180}, 0.3, { + onComplete: (twn:FlxTween) -> + { + new CostumeSelectSheet(); + twen = null; + } + }); + } + if (FlxG.mouse.pressed && mem.scale.x != 0.8) + mem.scale.set(0.8, 0.8); + } + else + { + if (mem.scale.x != 1) + mem.scale.set(1, 1); + if ((mem.y == 880 || mem.y == 1180) && twen == null) + twen = FlxTween.tween(mem, {y: 1030}, 0.3, { + onComplete: function(twn:FlxTween) + { + twen = null; + mem.loadGraphic(Paths.get('charselect_mini_BG.png')); + } + }); + } + + case 1: + if (FlxG.mouse.overlaps(mem)) + { + // if(FlxG.mouse.justReleased) openSubState(new OptionsSubState()); + if (FlxG.mouse.pressed && mem.scale.x != 0.8) + mem.scale.set(0.8, 0.8) + else if (!FlxG.mouse.pressed && mem.scale.x != 1.1) + mem.scale.set(1.1, 1.1); } - if(FlxG.mouse.pressed && mem.scale.x != 0.8) mem.scale.set(0.8, 0.8); - } else { - if(mem.scale.x != 1) mem.scale.set(1, 1); - if((mem.y == 880 || mem.y == 1180) && twen == null) - twen = FlxTween.tween(mem, {y: 1030}, 0.3, {onComplete: function(twn:FlxTween) { - twen = null; - mem.loadGraphic(Paths.get('charselect_mini_BG.png')); - }}); - } - - case 1: - if(FlxG.mouse.overlaps(mem)) { - //if(FlxG.mouse.justReleased) openSubState(new OptionsSubState()); - if(FlxG.mouse.pressed && mem.scale.x != 0.8) mem.scale.set(0.8, 0.8) - else if(!FlxG.mouse.pressed && mem.scale.x != 1.1) mem.scale.set(1.1, 1.1); - } else if(mem.scale.x != 1) mem.scale.set(1, 1); - - case 0: - if(FlxG.mouse.overlaps(mem)) { - if(FlxG.mouse.justReleased) player.use_sticker(player.sticker); - if(FlxG.mouse.pressed && mem.scale.x != 0.8) mem.scale.set(0.8, 0.8) - else if(!FlxG.mouse.pressed && mem.scale.x != 1.1) mem.scale.set(1.1, 1.1); - } else if(mem.scale.x != 1) mem.scale.set(1, 1); - } + else if (mem.scale.x != 1) + mem.scale.set(1, 1); + + case 0: + if (FlxG.mouse.overlaps(mem)) + { + if (FlxG.mouse.justReleased) + player.use_sticker(player.sticker); + if (FlxG.mouse.pressed && mem.scale.x != 0.8) + mem.scale.set(0.8, 0.8) + else if (!FlxG.mouse.pressed && mem.scale.x != 1.1) + mem.scale.set(1.1, 1.1); + } + else if (mem.scale.x != 1) + mem.scale.set(1, 1); + } /**if (Ctrl.jspecial[1]) new StickerSelectSheet();**/ handle_collisions(); @@ -187,12 +217,14 @@ class PlayState extends BaseState for (level in levels) level.place_entities(); } + function make_ui() { ui.add(new FlxSpriteExt(20, 20, Paths.get('heart.png'))); ui.add(new FlxSpriteExt(1708, 20, Paths.get('settings.png'))); ui.add(new FlxSpriteExt(1520, 1030, Paths.get('charselect_mini_BG.png'))); - ui.forEach((spr:FlxSpriteExt) -> { + ui.forEach((spr:FlxSpriteExt) -> + { spr.scrollFactor.set(0, 0); }); } From 57358fda5765657e8a4039367995d7b3787226d2 Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 15:09:57 +0100 Subject: [PATCH 3/7] added on_interact to interactables, which is called if the player presses the action key while in range of the interactable --- source/entities/Interactable.hx | 3 +++ source/entities/Minigame.hx | 10 ++++++---- source/entities/NPC.hx | 8 ++++++-- source/entities/Player.hx | 9 +++++---- source/entities/Present.hx | 16 ++++++++++++++-- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/source/entities/Interactable.hx b/source/entities/Interactable.hx index 033eee0a..ccb6803e 100644 --- a/source/entities/Interactable.hx +++ b/source/entities/Interactable.hx @@ -42,6 +42,9 @@ class Interactable extends NGSprite return null; } + // Called when in range and player presses interact button + public function on_interact() {} + function mark_target(mark:Bool) {} public static function unmark_all(interactables:FlxTypedGroup) diff --git a/source/entities/Minigame.hx b/source/entities/Minigame.hx index dd353c93..83704dfc 100644 --- a/source/entities/Minigame.hx +++ b/source/entities/Minigame.hx @@ -32,10 +32,12 @@ class Minigame extends Interactable super.update(elapsed); if (!marked) return; - if (Ctrl.jaction[1]) - { - start_minigame(); - } + if (Ctrl.jaction[1]) {} + } + + override function on_interact() + { + start_minigame(); } function start_minigame() diff --git a/source/entities/NPC.hx b/source/entities/NPC.hx index 57df7356..98966171 100644 --- a/source/entities/NPC.hx +++ b/source/entities/NPC.hx @@ -40,12 +40,16 @@ class NPC extends Interactable sprite_anim.anim(PresentAnimation.IDLE); case NEARBY: sprite_anim.anim(PresentAnimation.NEARBY); - if (Ctrl.jaction[1]) - start_chat(); case CHATTING: sprite_anim.anim(PresentAnimation.IDLE); } + override function on_interact() + { + if (state == NEARBY) + start_chat(); + } + function start_chat() { Ctrl.allFalse(); diff --git a/source/entities/Player.hx b/source/entities/Player.hx index 1b22c99b..c5995a77 100644 --- a/source/entities/Player.hx +++ b/source/entities/Player.hx @@ -174,12 +174,13 @@ class Player extends BaseUser // nothin } - if (target_changed) + closest.marked = true; + active_interactable = closest; + + if (Ctrl.jaction[1]) { - closest.marked = true; + active_interactable.on_interact(); } - - active_interactable = closest; } override function kill() diff --git a/source/entities/Present.hx b/source/entities/Present.hx index 5dbed466..a0c43e71 100644 --- a/source/entities/Present.hx +++ b/source/entities/Present.hx @@ -12,7 +12,13 @@ import states.substates.ComicSubstate; class Present extends Interactable { - public var openable:Bool = true; + public var openable(default, set):Bool = true; + + function set_openable(o) + { + interactable = o; + return openable = o; + } public static var opened:Bool = false; @@ -26,7 +32,6 @@ class Present extends Interactable { super(X, Y); detect_range = 300; - interactable = true; this.content = content; var presentData:PresentDef = JsonData.get_present(this.content); if (presentData == null) @@ -38,6 +43,8 @@ class Present extends Interactable opened = SaveManager.savedPresents.contains(content); day = Std.parseInt(presentData.day); + openable = true; + type = Interactable.InteractableType.PRESENT; loadGraphic(Paths.get('present-$content.png'), true, 94, 94); @@ -86,6 +93,11 @@ class Present extends Interactable thumbnail.sstate("OPEN"); } + override function on_interact() + { + open(); + } + override public function mark_target(mark:Bool) { if (!openable) From a745678df07c89435566974e6e27d3bb4fc2a0e2 Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 15:19:54 +0100 Subject: [PATCH 4/7] on_interact present --- source/entities/Present.hx | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/entities/Present.hx b/source/entities/Present.hx index a0c43e71..df243acc 100644 --- a/source/entities/Present.hx +++ b/source/entities/Present.hx @@ -84,8 +84,6 @@ class Present extends Interactable sprite_anim.anim(PresentAnimation.IDLE); case NEARBY: sprite_anim.anim(PresentAnimation.NEARBY); - if (Ctrl.jaction[1]) - open(); case OPENING: sprite_anim.anim(PresentAnimation.OPENING); case OPENED: From b81de46b78704bc0f1fc08bb4b5ee2fc859454aa Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 15:30:58 +0100 Subject: [PATCH 5/7] set present state to opened if getting close to it after opening it --- source/entities/Present.hx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/entities/Present.hx b/source/entities/Present.hx index df243acc..9bfb04b7 100644 --- a/source/entities/Present.hx +++ b/source/entities/Present.hx @@ -88,7 +88,6 @@ class Present extends Interactable sprite_anim.anim(PresentAnimation.OPENING); case OPENED: sprite_anim.anim(PresentAnimation.OPENED); - thumbnail.sstate("OPEN"); } override function on_interact() @@ -102,10 +101,13 @@ class Present extends Interactable return; if (mark) - sstate(NEARBY); + sstate(opened ? OPENED : NEARBY); else sstate(IDLE); + if (!opened) + return; + if (mark /** && thumbnail.scale.x == 0**/) { thumbnail.sstate("OPEN"); @@ -129,6 +131,7 @@ class Present extends Interactable { // TODO: sound effect sstate(OPENED); + thumbnail.sstate("OPEN"); PlayState.self.openSubState(comic ? new ComicSubstate(content, true) : new ArtSubstate(content)); opened = true; SaveManager.open_present(content, day); From d468b84f25bceeee9304731fffdc53270c659e05 Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 15:36:13 +0100 Subject: [PATCH 6/7] clup --- source/entities/Minigame.hx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/source/entities/Minigame.hx b/source/entities/Minigame.hx index 83704dfc..92e08995 100644 --- a/source/entities/Minigame.hx +++ b/source/entities/Minigame.hx @@ -27,14 +27,6 @@ class Minigame extends Interactable alpha = 0.5; } - override function update(elapsed:Float) - { - super.update(elapsed); - if (!marked) - return; - if (Ctrl.jaction[1]) {} - } - override function on_interact() { start_minigame(); From 3c9626937554c5fd9fd2ec2d6784614138bb32e2 Mon Sep 17 00:00:00 2001 From: jefvel Date: Sat, 30 Nov 2024 15:58:42 +0100 Subject: [PATCH 7/7] empty video text file --- assets/videos/videos-here.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/videos/videos-here.txt diff --git a/assets/videos/videos-here.txt b/assets/videos/videos-here.txt new file mode 100644 index 00000000..e69de29b