|
| 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 |
0 commit comments