Skip to content

Commit 679d56b

Browse files
authored
Merge branch 'master' into bubble_column
2 parents 4d98e9a + 238613b commit 679d56b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1663
-2
lines changed

Ahorn/entities/glassBerry.jl

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
module SpringCollab2020GlassBerryModule
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/glassBerry" GlassBerry(x::Integer, y::Integer, checkpointID::Integer=-1, order::Integer=-1, nodes::Array{Tuple{Integer, Integer}, 1}=Tuple{Integer, Integer}[])
6+
7+
const placements = Ahorn.PlacementDict(
8+
"Glass Strawberry (Spring Collab 2020)" => Ahorn.EntityPlacement(
9+
GlassBerry,
10+
"point"
11+
),
12+
)
13+
14+
Ahorn.nodeLimits(entity::GlassBerry) = 0, -1
15+
16+
function Ahorn.selection(entity::GlassBerry)
17+
x, y = Ahorn.position(entity)
18+
19+
nodes = get(entity.data, "nodes", ())
20+
hasPips = length(nodes) > 0
21+
22+
sprite = "collectables/SpringCollab2020/glassBerry/idle00"
23+
seedSprite = "collectables/strawberry/seed00"
24+
25+
res = Ahorn.Rectangle[Ahorn.getSpriteRectangle(sprite, x, y)]
26+
27+
for node in nodes
28+
nx, ny = node
29+
30+
push!(res, Ahorn.getSpriteRectangle(seedSprite, nx, ny))
31+
end
32+
33+
return res
34+
end
35+
36+
function Ahorn.renderSelectedAbs(ctx::Ahorn.Cairo.CairoContext, entity::GlassBerry)
37+
x, y = Ahorn.position(entity)
38+
39+
for node in get(entity.data, "nodes", ())
40+
nx, ny = node
41+
42+
Ahorn.drawLines(ctx, Tuple{Number, Number}[(x, y), (nx, ny)], Ahorn.colors.selection_selected_fc)
43+
end
44+
end
45+
46+
function Ahorn.renderAbs(ctx::Ahorn.Cairo.CairoContext, entity::GlassBerry, room::Maple.Room)
47+
x, y = Ahorn.position(entity)
48+
49+
nodes = get(entity.data, "nodes", ())
50+
hasPips = length(nodes) > 0
51+
52+
sprite = "collectables/SpringCollab2020/glassBerry/idle00"
53+
seedSprite = "collectables/strawberry/seed00"
54+
55+
for node in nodes
56+
nx, ny = node
57+
58+
Ahorn.drawSprite(ctx, seedSprite, nx, ny)
59+
end
60+
61+
Ahorn.drawSprite(ctx, sprite, x, y)
62+
end
63+
64+
end

Ahorn/entities/moveBlockBarrier.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module SpringCollab2020MoveBlockBarrier
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/moveBlockBarrier" MoveBlockBarrier(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight)
6+
7+
const placements = Ahorn.PlacementDict(
8+
"Move Block Barrier (Spring Collab 2020)" => Ahorn.EntityPlacement(
9+
MoveBlockBarrier,
10+
"rectangle"
11+
),
12+
)
13+
14+
Ahorn.minimumSize(entity::MoveBlockBarrier) = 8, 8
15+
Ahorn.resizable(entity::MoveBlockBarrier) = true, true
16+
17+
function Ahorn.selection(entity::MoveBlockBarrier)
18+
x, y = Ahorn.position(entity)
19+
20+
width = Int(get(entity.data, "width", 8))
21+
height = Int(get(entity.data, "height", 8))
22+
23+
return Ahorn.Rectangle(x, y, width, height)
24+
end
25+
26+
function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::MoveBlockBarrier, room::Maple.Room)
27+
width = Int(get(entity.data, "width", 32))
28+
height = Int(get(entity.data, "height", 32))
29+
30+
Ahorn.drawRectangle(ctx, 0, 0, width, height, (0.45, 0.0, 0.45, 0.8), (0.0, 0.0, 0.0, 0.0))
31+
end
32+
33+
end

Ahorn/entities/sidewaysJumpThru.jl

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
module SpringCollab2020SidewaysJumpThru
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/SidewaysJumpThru" SidewaysJumpThru(x::Integer, y::Integer, height::Integer=Maple.defaultBlockHeight,
6+
left::Bool=true, texture::String="wood")
7+
8+
textures = ["wood", "dream", "temple", "templeB", "cliffside", "reflection", "core", "moon"]
9+
const placements = Ahorn.PlacementDict()
10+
11+
for texture in textures
12+
placements["Sideways Jump Through ($(uppercasefirst(texture)), Left) (Spring Collab 2020)"] = Ahorn.EntityPlacement(
13+
SidewaysJumpThru,
14+
"rectangle",
15+
Dict{String, Any}(
16+
"texture" => texture,
17+
"left" => true
18+
)
19+
)
20+
placements["Sideways Jump Through ($(uppercasefirst(texture)), Right) (Spring Collab 2020)"] = Ahorn.EntityPlacement(
21+
SidewaysJumpThru,
22+
"rectangle",
23+
Dict{String, Any}(
24+
"texture" => texture,
25+
"left" => false
26+
)
27+
)
28+
end
29+
30+
quads = Tuple{Integer, Integer, Integer, Integer}[
31+
(0, 0, 8, 7) (8, 0, 8, 7) (16, 0, 8, 7);
32+
(0, 8, 8, 5) (8, 8, 8, 5) (16, 8, 8, 5)
33+
]
34+
35+
Ahorn.editingOptions(entity::SidewaysJumpThru) = Dict{String, Any}(
36+
"texture" => textures
37+
)
38+
39+
Ahorn.minimumSize(entity::SidewaysJumpThru) = 0, 8
40+
Ahorn.resizable(entity::SidewaysJumpThru) = false, true
41+
42+
function Ahorn.selection(entity::SidewaysJumpThru)
43+
x, y = Ahorn.position(entity)
44+
height = Int(get(entity.data, "height", 8))
45+
46+
return Ahorn.Rectangle(x, y, 8, height)
47+
end
48+
49+
function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::SidewaysJumpThru, room::Maple.Room)
50+
texture = get(entity.data, "texture", "wood")
51+
texture = texture == "default" ? "wood" : texture
52+
53+
# Values need to be system specific integer
54+
x = Int(get(entity.data, "x", 0))
55+
y = Int(get(entity.data, "y", 0))
56+
57+
height = Int(get(entity.data, "height", 8))
58+
left = get(entity.data, "left", true)
59+
60+
startX = div(x, 8) + 1
61+
startY = div(y, 8) + 1
62+
stopY = startY + div(height, 8) - 1
63+
64+
Ahorn.Cairo.save(ctx)
65+
66+
Ahorn.rotate(ctx, pi / 2)
67+
68+
if left
69+
Ahorn.scale(ctx, 1, -1)
70+
end
71+
72+
len = stopY - startY
73+
for i in 0:len
74+
connected = false
75+
qx = 2
76+
if i == 0
77+
connected = get(room.fgTiles.data, (startY - 1, startX), false) != '0'
78+
qx = 1
79+
80+
elseif i == len
81+
connected = get(room.fgTiles.data, (stopY + 1, startX), false) != '0'
82+
qx = 3
83+
end
84+
85+
quad = quads[2 - connected, qx]
86+
Ahorn.drawImage(ctx, "objects/jumpthru/$(texture)", 8 * i, left ? 0 : -8, quad...)
87+
end
88+
89+
Ahorn.Cairo.restore(ctx)
90+
end
91+
92+
end
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
module SpringCollab2020UpsideDownJumpThru
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/UpsideDownJumpThru" UpsideDownJumpThru(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, texture::String="wood")
6+
7+
textures = ["wood", "dream", "temple", "templeB", "cliffside", "reflection", "core", "moon"]
8+
const placements = Ahorn.PlacementDict(
9+
"Upside Down Jump Through ($(uppercasefirst(texture))) (Spring Collab 2020)" => Ahorn.EntityPlacement(
10+
UpsideDownJumpThru,
11+
"rectangle",
12+
Dict{String, Any}(
13+
"texture" => texture
14+
)
15+
) for texture in textures
16+
)
17+
18+
quads = Tuple{Integer, Integer, Integer, Integer}[
19+
(0, 0, 8, 7) (8, 0, 8, 7) (16, 0, 8, 7);
20+
(0, 8, 8, 5) (8, 8, 8, 5) (16, 8, 8, 5)
21+
]
22+
23+
Ahorn.editingOptions(entity::UpsideDownJumpThru) = Dict{String, Any}(
24+
"texture" => textures
25+
)
26+
27+
Ahorn.minimumSize(entity::UpsideDownJumpThru) = 8, 0
28+
Ahorn.resizable(entity::UpsideDownJumpThru) = true, false
29+
30+
function Ahorn.selection(entity::UpsideDownJumpThru)
31+
x, y = Ahorn.position(entity)
32+
width = Int(get(entity.data, "width", 8))
33+
34+
return Ahorn.Rectangle(x, y, width, 8)
35+
end
36+
37+
function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::UpsideDownJumpThru, room::Maple.Room)
38+
texture = get(entity.data, "texture", "wood")
39+
texture = texture == "default" ? "wood" : texture
40+
41+
# Values need to be system specific integer
42+
x = Int(get(entity.data, "x", 0))
43+
y = Int(get(entity.data, "y", 0))
44+
45+
width = Int(get(entity.data, "width", 8))
46+
47+
startX = div(x, 8) + 1
48+
stopX = startX + div(width, 8) - 1
49+
startY = div(y, 8) + 1
50+
51+
Ahorn.Cairo.save(ctx)
52+
53+
Ahorn.scale(ctx, 1, -1)
54+
55+
len = stopX - startX
56+
for i in 0:len
57+
connected = false
58+
qx = 2
59+
if i == 0
60+
connected = get(room.fgTiles.data, (startY, startX - 1), false) != '0'
61+
qx = 1
62+
63+
elseif i == len
64+
connected = get(room.fgTiles.data, (startY, stopX + 1), false) != '0'
65+
qx = 3
66+
end
67+
68+
quad = quads[2 - connected, qx]
69+
Ahorn.drawImage(ctx, "objects/jumpthru/$(texture)", 8 * i, -8, quad...)
70+
end
71+
72+
Ahorn.Cairo.restore(ctx)
73+
end
74+
75+
end

Ahorn/lang/en_gb.lang

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,11 @@ placements.entities.SpringCollab2020/CustomizableGlassBlockController.tooltips.b
4646
placements.entities.SpringCollab2020/bubblePushField.tooltips.strength=The strength with which the bubbles push objects within.
4747
placements.entities.SpringCollab2020/bubblePushField.tooltips.upwardStrength=How much the bubbles push the player up to compensate for gravity.
4848
placements.entities.SpringCollab2020/bubblePushField.tooltips.direction=The direction the bubbles push the player.
49-
placements.entities.SpringCollab2020/bubblePushField.tooltips.water=If the bubble field will create a Water entity to make its presence visible.
49+
placements.entities.SpringCollab2020/bubblePushField.tooltips.water=If the bubble field will create a Water entity to make its presence visible.
50+
51+
# Upside Down Jump Thru
52+
placements.entities.SpringCollab2020/UpsideDownJumpThru.tooltips.texture=Changes the appearance of the platform.
53+
54+
# Sideways Jump Thru
55+
placements.entities.SpringCollab2020/SidewaysJumpThru.tooltips.texture=Changes the appearance of the platform.
56+
placements.entities.SpringCollab2020/SidewaysJumpThru.tooltips.left=Whether the solid side of the jumpthru is the left side.

0 commit comments

Comments
 (0)