Open the doors, please.
Day 19-24
English isn't my first language, so I might write some broken English.
Every game needs some kind of interaction to call it a game.
So what interaction have I implemented?
1. Functionality to open doors with pressing buttons!
The above gif image shows everything. (except for the button click sound effect)
How does it work?
Well, it's complicated:
I have these blue IEntity-derived classes, and they store some datas. (including sprite & animations)
For example...
entity::Player class stores sprites and animations of our protagonist star character.
It also stores some collider infos (i.e. rects and points) shown above.
In the scene::Game lie ISystem-derived objects,
which are responsible for updating the IEntity datas within the Game scene.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | // scene_Game.h class Game final : public IScene { public: ... [[nodiscard]] bn::optional<Type> Update() final; private: ... // All member variables reside in here. // to easily pass states by reference into Systems. GameState state_; system::PlayerMovement playerMovement_; system::ButtonInteraction buttonInteraction_; ... }; | cs |
I have this GameState variable which holds all the members (including Entities) of the Game scene,
and it is passed by reference to each Systems.
And each System updates the GameState.
1 2 3 4 5 6 | bn::optional<Type> Game::Update() { playerMovement_.Update(); buttonInteraction_.Update(); ... } | cs |
I think this approach is not the greatest, but it somewhat modularizes the code to the managable state.
Hey, but you've never mentioned how does the button works!
Yup, but it would make this article at least 4 times more long...
So I'll just call it a day now. Sorry.
You can always check my source code on GitHub, if you want.
GitHub tag : Day-24
Select : Enable/Disable debug view
L : use Left hand / R : use Right hand
Get Symbol★Merged
Symbol★Merged
[Demo] A puzzle platformer game for GBA where you can merge items in hands, and use its superpower.
Status | In development |
Author | copyrat90 |
Genre | Puzzle, Platformer |
Tags | Game Boy Advance, gbajam, gbajam2021, Puzzle-Platformer |
More posts
- Demo released!Jul 11, 2021
- Spikes will hurt youJun 29, 2021
- Turning into a gameJun 22, 2021
- Platforming physicsJun 14, 2021
- Edge-snapping cameraJun 03, 2021
- Displaying itemsMay 30, 2021
- Rudimentary Title screenMay 23, 2021
- Refactoring transitionMay 20, 2021
- Let's start the journey!May 17, 2021
Leave a comment
Log in with itch.io to leave a comment.