|
| 1 | +module SpringCollab2020SeekerStatueCustomColors |
| 2 | + |
| 3 | +using ..Ahorn, Maple |
| 4 | + |
| 5 | +@mapdef Entity "SpringCollab2020/SeekerStatueCustomColors" SeekerStatueCustomColors(x::Integer, y::Integer, hatch::String="Distance", nodes::Array{Tuple{Integer, Integer}, 1}=Tuple{Integer, Integer}[], |
| 6 | + breakOutParticleColor1::String="643e73", breakOutParticleColor2::String="3e2854", attackParticleColor1::String="99e550", attackParticleColor2::String="ddffbc", |
| 7 | + regenParticleColor1::String="cbdbfc", regenParticleColor2::String="575fd9", trailColor::String="99e550") |
| 8 | + |
| 9 | +const placements = Ahorn.PlacementDict( |
| 10 | + "Seeker Statue (Custom Colors) (Spring Collab 2020)" => Ahorn.EntityPlacement( |
| 11 | + SeekerStatueCustomColors, |
| 12 | + "point", |
| 13 | + Dict{String, Any}(), |
| 14 | + function(entity) |
| 15 | + entity.data["nodes"] = [(Int(entity.data["x"]) + 32, Int(entity.data["y"]))] |
| 16 | + end |
| 17 | + ) |
| 18 | +) |
| 19 | + |
| 20 | +Ahorn.nodeLimits(entity::SeekerStatueCustomColors) = 1, -1 |
| 21 | + |
| 22 | +Ahorn.editingOptions(entity::SeekerStatueCustomColors) = Dict{String, Any}( |
| 23 | + "hatch" => Maple.seeker_statue_hatches |
| 24 | +) |
| 25 | + |
| 26 | +function Ahorn.selection(entity::SeekerStatueCustomColors) |
| 27 | + nodes = get(entity.data, "nodes", ()) |
| 28 | + x, y = Ahorn.position(entity) |
| 29 | + |
| 30 | + res = Ahorn.Rectangle[Ahorn.getSpriteRectangle(statueSprite, x, y)] |
| 31 | + |
| 32 | + for node in nodes |
| 33 | + nx, ny = node |
| 34 | + |
| 35 | + push!(res, Ahorn.getSpriteRectangle(monsterSprite, nx, ny)) |
| 36 | + end |
| 37 | + |
| 38 | + return res |
| 39 | +end |
| 40 | + |
| 41 | +statueSprite = "decals/5-temple/statue_e.png" |
| 42 | +monsterSprite = "characters/monsters/predator73.png" |
| 43 | + |
| 44 | +function Ahorn.renderSelectedAbs(ctx::Ahorn.Cairo.CairoContext, entity::SeekerStatueCustomColors) |
| 45 | + px, py = Ahorn.position(entity) |
| 46 | + |
| 47 | + for node in get(entity.data, "nodes", ()) |
| 48 | + nx, ny = Int.(node) |
| 49 | + |
| 50 | + Ahorn.drawArrow(ctx, px, py, nx, ny, Ahorn.colors.selection_selected_fc, headLength=6) |
| 51 | + Ahorn.drawSprite(ctx, monsterSprite, nx, ny) |
| 52 | + |
| 53 | + px, py = nx, ny |
| 54 | + end |
| 55 | +end |
| 56 | + |
| 57 | +Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::SeekerStatueCustomColors, room::Maple.Room) = Ahorn.drawSprite(ctx, statueSprite, 0, 0) |
| 58 | + |
| 59 | +end |
0 commit comments