First Code Lines
One of the ideas for Green Memories is to have a day/night cycle that will happen during gameplay, for that we'll need smooth transitions. The simplest and most effective way to do this is through fade-in/fade-out logic. Luckily, Butano already has an abstraction for color blending, so we can use that for our fade-out.
With some creativity I wrote a utility function that I hope will help us for the rest of the project:
void fade_out(bool &fading_out, bn::bg_palette_ptr background, void (*callback)()) { if (background.fade_intensity() >= 1) { fading_out = false; callback(); } if (background.fade_intensity() <= 0) { background.set_fade(bn::colors::black, 0); background.set_fade_intensity(0); } background.set_fade_intensity(bn::min(background.fade_intensity() + 0.01, bn::fixed(1))); }
The fading_out parameter is nothing more than the address of the boolean that tells us if our fade out should be executed, and that last weird parameter is nothing more than the address of a function that I want to be executed when the fade out is finished. So basically I can pass functions as parameters.
After creating the fade in function using the same logic, we are able to make a splash screen with our logo:
void end_scene() { scene_ended = true; } void call_fade_out() { fading_out = true; } void logo_scene() { bn::regular_bg_ptr logo_bg = bn::regular_bg_items::logo.create_bg(0, 0); bn::bg_palette_ptr logo_bg_palette = logo_bg.palette(); logo_bg_palette.set_fade(bn::colors::black, 1); scene_ended = false; fading_in = true; while (!scene_ended) { if(fading_out) { fade_out(fading_out, logo_bg_palette, &end_scene); } if(fading_in) { fade_in(fading_in, logo_bg_palette, &call_fade_out); } bn::core::update(); } }
This brings us this result:
Get Green Memories
Green Memories
GBA Survival RPG
Status | In development |
Author | Tengukaze Studio |
Genre | Survival, Adventure, Role Playing |
Tags | Atmospheric, Cyberpunk, Exploration, Female Protagonist, Game Boy Advance, Pixel Art, Top-Down |
More posts
- Update v1.4.722 days ago
- Update v1.4.678 days ago
- Update v1.4.5Jul 04, 2024
- Update v1.3.0May 22, 2023
- Update v1.2.0Mar 02, 2023
- Green Memories em PTBR!Nov 27, 2022
- Green Memories First ReleaseOct 26, 2022
- Player, Animations and RPG HUDSep 02, 2022
- Using Unity to Create GBA games pt. 2Aug 29, 2022
- 8 directions movement like GBC/GBA ZeldaAug 17, 2022
Leave a comment
Log in with itch.io to leave a comment.