Skip to content

Commit f378b08

Browse files
authored
Merge pull request #129 from EverestAPI/no_dash_refill_spring_sprite
Add a specific sprite for No Dash Refill Spring
2 parents df16dd8 + 34543de commit f378b08

File tree

9 files changed

+16
-3
lines changed

9 files changed

+16
-3
lines changed

Ahorn/entities/noDashRefillSpring.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ function Ahorn.selection(entity::NoDashRefillSpringRight)
3636
return Ahorn.Rectangle(x - 4, y - 6, 5, 12)
3737
end
3838

39-
sprite = "objects/spring/00.png"
39+
sprite = "objects/SpringCollab2020/noDashRefillSpring/00.png"
4040

4141
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::NoDashRefillSpring, room::Maple.Room) = Ahorn.drawSprite(ctx, sprite, 0, -8)
42-
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::NoDashRefillSpringLeft, room::Maple.Room) = Ahorn.drawSprite(ctx, sprite, 9, -11, rot=pi / 2)
43-
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::NoDashRefillSpringRight, room::Maple.Room) = Ahorn.drawSprite(ctx, sprite, 3, 1, rot=-pi / 2)
42+
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::NoDashRefillSpringLeft, room::Maple.Room) = Ahorn.drawSprite(ctx, sprite, 24, 0, rot=pi / 2)
43+
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::NoDashRefillSpringRight, room::Maple.Room) = Ahorn.drawSprite(ctx, sprite, -8, 16, rot=-pi / 2)
4444

4545
end

Entities/NoDashRefillSpring.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Celeste.Mod.Entities;
22
using Microsoft.Xna.Framework;
33
using Monocle;
4+
using MonoMod.Utils;
45
using System;
56
using System.Reflection;
67

@@ -13,6 +14,8 @@ class NoDashRefillSpring : Spring {
1314
public NoDashRefillSpring(EntityData data, Vector2 offset)
1415
: base(data.Position + offset, GetOrientationFromName(data.Name), data.Bool("playerCanUse", true)) {
1516

17+
DynData<Spring> selfSpring = new DynData<Spring>(this);
18+
1619
// remove the vanilla player collider. this is the one thing we want to mod here.
1720
foreach (Component component in this) {
1821
if (component.GetType() == typeof(PlayerCollider)) {
@@ -25,6 +28,16 @@ public NoDashRefillSpring(EntityData data, Vector2 offset)
2528
if (data.Bool("playerCanUse", true)) {
2629
Add(new PlayerCollider(OnCollide));
2730
}
31+
32+
// replace the vanilla sprite with our custom one.
33+
Sprite sprite = selfSpring.Get<Sprite>("sprite");
34+
sprite.Reset(GFX.Game, "objects/SpringCollab2020/noDashRefillSpring/");
35+
sprite.Add("idle", "", 0f, default(int));
36+
sprite.Add("bounce", "", 0.07f, "idle", 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5);
37+
sprite.Add("disabled", "white", 0.07f);
38+
sprite.Play("idle");
39+
sprite.Origin.X = sprite.Width / 2f;
40+
sprite.Origin.Y = sprite.Height;
2841
}
2942

3043
private static Orientations GetOrientationFromName(string name) {
188 Bytes
Loading
224 Bytes
Loading
214 Bytes
Loading
224 Bytes
Loading
233 Bytes
Loading
204 Bytes
Loading
193 Bytes
Loading

0 commit comments

Comments
 (0)