Skip to content

Commit e7bfcb6

Browse files
committed
Added Attached Ice Wall
This was developed independently of Shroom Helper and does not intend to replace it outside of the collab; this was only made to avoid adding new dependencies to the collab for the new Grandmaster Heartside.
1 parent d58f5e4 commit e7bfcb6

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

Ahorn/entities/attachedIceWall.jl

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
module SpringCollab2020AttachedIceWall
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/AttachedIceWall" AttachedIceWall(x::Integer, y::Integer, height::Integer=8, left::Bool=false)
6+
7+
const placements = Ahorn.PlacementDict(
8+
"Attached Ice Wall (Right) (Spring Collab 2020)" => Ahorn.EntityPlacement(
9+
AttachedIceWall,
10+
"rectangle",
11+
Dict{String, Any}(
12+
"left" => true
13+
)
14+
),
15+
"Attached Ice Wall (Left) (Spring Collab 2020)" => Ahorn.EntityPlacement(
16+
AttachedIceWall,
17+
"rectangle",
18+
Dict{String, Any}(
19+
"left" => false
20+
)
21+
)
22+
)
23+
24+
Ahorn.minimumSize(entity::AttachedIceWall) = 0, 8
25+
Ahorn.resizable(entity::AttachedIceWall) = false, true
26+
27+
function Ahorn.selection(entity::AttachedIceWall)
28+
x, y = Ahorn.position(entity)
29+
height = Int(get(entity.data, "height", 8))
30+
31+
return Ahorn.Rectangle(x, y, 8, height)
32+
end
33+
34+
function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::AttachedIceWall, room::Maple.Room)
35+
left = get(entity.data, "left", false)
36+
37+
# Values need to be system specific integer
38+
x = Int(get(entity.data, "x", 0))
39+
y = Int(get(entity.data, "y", 0))
40+
41+
height = Int(get(entity.data, "height", 8))
42+
tileHeight = div(height, 8)
43+
44+
if left
45+
for i in 2:tileHeight - 1
46+
Ahorn.drawImage(ctx, "objects/wallBooster/iceMid00", 0, (i - 1) * 8)
47+
end
48+
49+
Ahorn.drawImage(ctx, "objects/wallBooster/iceTop00", 0, 0)
50+
Ahorn.drawImage(ctx, "objects/wallBooster/iceBottom00", 0, (tileHeight - 1) * 8)
51+
52+
else
53+
Ahorn.Cairo.save(ctx)
54+
Ahorn.scale(ctx, -1, 1)
55+
56+
for i in 2:tileHeight - 1
57+
Ahorn.drawImage(ctx, "objects/wallBooster/iceMid00", -8, (i - 1) * 8)
58+
end
59+
60+
Ahorn.drawImage(ctx, "objects/wallBooster/iceTop00", -8, 0)
61+
Ahorn.drawImage(ctx, "objects/wallBooster/iceBottom00", -8, (tileHeight - 1) * 8)
62+
63+
Ahorn.restore(ctx)
64+
end
65+
end
66+
67+
# Offset X position so it flips in place
68+
function Ahorn.flipped(entity::AttachedIceWall, horizontal::Bool)
69+
if horizontal
70+
entity.left = !entity.left
71+
entity.x += entity.left ? 8 : -8
72+
73+
return entity
74+
end
75+
end
76+
77+
end

Ahorn/lang/en_gb.lang

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,6 @@ placements.effects.SpringCollab2020/BlackholeCustomColors.tooltips.colorsWild=Co
345345
placements.effects.SpringCollab2020/BlackholeCustomColors.tooltips.bgColorInner=The color used for the background at the center of the screen.
346346
placements.effects.SpringCollab2020/BlackholeCustomColors.tooltips.bgColorOuterMild=The color used for the background at the edges of the screen, when the blackhole strength is Mild.
347347
placements.effects.SpringCollab2020/BlackholeCustomColors.tooltips.bgColorOuterWild=The color used for the background at the edges of the screen, when the blackhole strength is Wild.
348+
349+
# Attached Ice Wall
350+
placements.entities.SpringCollab2020/AttachedIceWall.tooltips.left=Whether the entity attaches to the left wall or not.

Entities/AttachedIceWall.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Celeste.Mod.Entities;
2+
using Microsoft.Xna.Framework;
3+
using Monocle;
4+
5+
namespace Celeste.Mod.SpringCollab2020.Entities {
6+
[CustomEntity("SpringCollab2020/AttachedIceWall")]
7+
static class AttachedIceWall {
8+
public static Entity Load(Level level, LevelData levelData, Vector2 offset, EntityData entityData) {
9+
// an attached ice wall is just like a regular "not core mode" wall booster, but with a different static mover hitbox.
10+
bool left = entityData.Bool("left");
11+
WallBooster iceWall = new WallBooster(entityData.Position + offset, entityData.Height, left, notCoreMode: true);
12+
StaticMover staticMover = iceWall.Get<StaticMover>();
13+
staticMover.SolidChecker = solid => iceWall.CollideCheck(solid, iceWall.Position + (left ? -2 : 2) * Vector2.UnitX);
14+
return iceWall;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)