Continuing the build out of the zone 3 in level 3-1. I’ll start with a platform that is self rising when the player jumps on it. Always a classic; and honestly, I think the start of the level can use that. Lift does feel a little slow. I boosted the speed from 70 to 90. Also started added floating balloons with mines around this part of the level, since those elements were introduced in zone 2.
Hmm, I wonder if I should make a variant of the red balloon with mine. The mines will kill you, but the player can safely land on the top of the red balloon. I’m wondering if a variant that is unsafe for the player could be useful. Maybe a “spiky balloon” type. It can be attached to the grey mine I made for level 2-2.
Alternatively, I can make it a different colour and just make it such that landing on it will pop the balloon. Took a brief look at a colour blindness test and it looks like red and green is the way to go for two distinguished colours.
Hit a roadblock: I need to import a type, the TextureVariant
enum, from one script (the static mine) into another one (balloon_with_static_mine). Quick web search and it looks like the way to do this is by “preloading” a script. This gives you access to the script’s symbols:
const StaticMine = preload("res://scripts/static_mine.gd")
@export var mine_texture_variant: StaticMine.TextureVariant
To support popping when the player lands on it, the balloon is an AnimatableBody2D
which can detect collisions as it bobs up and down. I wonder if I can actually test collision that way:
var coll = animatable_body_2d.move_and_collide(velocity)
if coll != null:
if coll.get_collider().name == "Player":
print("Bang!")
No, turns out I can’t. Tried this and even played around with layers a little, and it didn’t detect when the player landed on it. So moving to plan B, which is adding an Area2D set to layer 2, the same layer as the player. When the player lands in that, it will pop the balloon… eventually. At the moment it just makes the balloon disappear. I’ll need to add the pop animation and sound effects. It will also give the player a jump at at about the same distance they would travel in a normal jump.
Okay, new variant implemented. Here’s how it looks:
I was going for something a little deadlier, but I think having the extra jump could make for some interesting mechanics. I guess we’ll see. Anyway, I’ll leave it there this evening. I’ve managed to get 2/3rds of new section built out.