Connecting objects (eg. destroying a fuse box to open a door)
Some art
For this feature I made some textures and a model for a fusebox (both an intact and a destroyed version):
Connecting objects
As for the scanner, opening doors or basically almost any interaction the affected classes / scripts have an "interact" method with one object parameter that can be anything.
Since Godot loves duct-typing (https://en.wikipedia.org/wiki/Duck_typing) I can just check if the object has an interact method - or in some very specific cases I can check type but I think I'll convert those parts to method checks as well.
If interaction can be made, then, in the case of the fusebox and crossbow, the body of the fusebox is the object that interacts with the ray we cast as it was the crossbow projectile.
Since the main script for the fusebox is attached to the fuse box scene itself, we use the static body only as a proxy to call the actual interaction method.
Interactions like these are easy and the same can be said for connecting the objects. The fusebox - or any object that connects another one - only needs the node path for the door to get the door object...which has an interact method as well.
Ammo types and states for destroyable objects
I implemented ammo types as enum - later there will be a difference in the shooting animation as well:
- default
- shock
- explosive
- freezing
- any
The "any" AmmoType is basically an indicator for objects like the fusebox that any type of ammo can destroy them. Later this will be changed for the fusebox although to a specific ammo type.
When the crossbow interacts with the fuse box, we pass an object that contains informations including the ammo type, so the shot object can check it and react accordingly.
For destroyable objects like the fuse box, another enum was made with these values:
- intact
- destroyed
We can't do anything with a destroyed fuse box, but we can destroy an intact one, and if it happens, the fuse box will call the interact method of the door, thus opening it.
Possibilites
There can be a lot of interesting gameplay mechanics made with this features. We can for example shoot an object on the ceiling, thus making it fall on the enemies, or we can make puzzles with switches that connects to each other.
Get ShadowStalker
ShadowStalker
64x64 FPS for LOWREZJAM2022
Status | In development |
Author | Atanii |
Genre | Adventure |
Tags | 3D, First-Person, Metroidvania, Pixel Art, Singleplayer |
Languages | English |
More posts
- First playable versionAug 13, 2022
- Adding sounds, explosive ammo, testing maps...Aug 13, 2022
- Slowly putting the pieces together (very short devlog)Aug 11, 2022
- More or less a break dayAug 10, 2022
- Again...still modelling, but with some programming as wellAug 09, 2022
- Still modelling the Dead City (very short devlog)Aug 08, 2022
- Modelling the city level, making new textures, modelsAug 07, 2022
- Working on the textures for the Dead City (short devlog)Aug 06, 2022
- Multi-phase boss fight, pickable items...Aug 06, 2022
Leave a comment
Log in with itch.io to leave a comment.