//DEBRIS AND TELEKINESIS//
For the past couple of weeks I have been focused on porting over two of the more complicated systems from the demo: the block falling system and the telekinesis casting state machine.
//BLOCK FALLING//
I learned how to build custom functions since falling blocks happen every ~10 seconds, fall at different locations, and have other attributes. So they will be called often and I didn’t want to repeat big blocks of action every time. Here is what my custom function looks like:
This function lets me:
- Pick the object
- Pick the start X location (off-screen since it falls into view)
- Landing Y value (since this is a top-down game)
- Whether it will be a “hole” or “debris”
- Call the shadow object at the same Y value
Here is what the setup of that function looks like:
I don’t want the blocks to fall to random locations because they are essentially a puzzle and, with this being a time loop game, I want the player to be able to memorize the locations and types of blocks that fall.
//TELEKINESIS CASTING//
As part of the puzzle, the player can cast telekinesis that creates a reticle that they can then move around with the same controls. If they place the reticle on a debris block, they can then move that block to fill holes/clear the way. The design of this game includes simple controls (movement and one action button), so I would need to be able to toggle between these casting states by pushing one button. The state machine looks like this:
I had previously set this up in construct using an If, Else statement that just called functions. Unfortunately, this wasn’t as easy in GDevelop due to a lack of Else statement. BUT I got some excellent help from the community in the forums and was able to set up a working state machine to contextually toggle between these states by pressing one key.
Here is the state machine in play, with the current state displayed in the upper left.
Up next: Fill in holes by moving blocks and the orb puzzle system.
Bye!