-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module RecordingStations | ||
|
||
using ..Ahorn, Maple | ||
|
||
@mapdef Entity "RecordingStations/RecordingStation" RecordingStation(x::Integer, y::Integer) | ||
|
||
const placements = Ahorn.PlacementDict( | ||
"Recording Station (Recording Stations)" => Ahorn.EntityPlacement( | ||
RecordingStation | ||
) | ||
) | ||
|
||
function Ahorn.selection(entity::RecordingStation) | ||
x, y = Ahorn.position(entity) | ||
width = 32 | ||
height = 16 | ||
|
||
return Ahorn.Rectangle(x - 16, y, width, height) | ||
end | ||
|
||
# TODO: change sprite | ||
sprite = "objects/pico8Console" | ||
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::RecordingStation, room::Maple.Room) = Ahorn.drawSprite(ctx, sprite, 0, 0) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Celeste; | ||
using Celeste.Mod.Entities; | ||
using Microsoft.Xna.Framework; | ||
using Monocle; | ||
|
||
namespace RecordingStations.Entities | ||
{ | ||
/// <summary> | ||
/// A Recording Station the player can interact with. | ||
/// </summary> | ||
[CustomEntity("RecordingStations/RecordingStation")] | ||
public class RecordingStation : Entity | ||
{ | ||
public TalkComponent InteractComponent; | ||
|
||
public RecordingStation(EntityData data, Vector2 offset) | ||
: base (data.Position + offset) | ||
{ | ||
Depth = 1000; | ||
Vector2 drawAt = new Vector2(data.Width / 2.0f, 0.0f); | ||
Add(InteractComponent = new TalkComponent( | ||
new Rectangle(-8, 0, 16, 16), | ||
drawAt, | ||
Interact)); | ||
|
||
Image image = new Image(GFX.Game["objects/pico8Console"]); | ||
image.JustifyOrigin(0.5f, 0.5f); | ||
Add(image); | ||
} | ||
|
||
public void Interact(Player player) | ||
{ | ||
RecordingSystem.AdvanceNext(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Celeste.Mod; | ||
|
||
namespace RecordingStations | ||
{ | ||
/// <summary> | ||
/// This is the base class for the recording and playback system. | ||
/// </summary> | ||
public static class RecordingSystem | ||
{ | ||
public enum RecordingMode | ||
{ | ||
Idle, | ||
Recording, | ||
Playback, | ||
} | ||
|
||
public static RecordingMode CurrentMode { get; private set; } = RecordingMode.Idle; | ||
|
||
public static void AdvanceNext() | ||
{ | ||
CurrentMode++; | ||
if (CurrentMode > RecordingMode.Playback) | ||
CurrentMode = RecordingMode.Idle; | ||
|
||
Logger.Log("RecStation", "Changing mode to " + CurrentMode); | ||
} | ||
} | ||
} |