Dirty Stop Out | Remake: Part 1, Recycling GameObjects
I decided to remake DirtyStopOut now that I had some experience scripting Unity - I felt I could make the game a lot better the second time around.
Re-Using Musical Notes
The first change was , instead of having unlimited amount of musical notes spawn, to have just 4 notes that would be moved from the top of the screen back to the bottom so that they could be re-used. Destroying objects causes them to clog up the memory, and so it's much more optimal to re-use them where possible or hide / show objects rather than destroy them.
KillZone
This KillZone game object contains a Box Collider Trigger component as well as a KillZone script that contains the logic for moving the notes from the top to the bottom of the screen again.
Note Spawn Points
I have a bunch of spawn points (I attached a Pink sphere to them so that they are visible) which each have a NoteSpawnPoint tag applied to them and are staggered to cause the notes to spawn be staggered.
Re-spawning Notes
The KillZone script automatically finds all of the GameObjects in the scene with the tag NoteSpawnPoint and adds them to a list at Runtime. When musical notes hit the KillZone Trigger, a random number is generated (between 0 and the length of spawn points in the list) and moves the collided object to that position.
Randomising the Note Type
Once the note has been re-spawned, it also has a chance to re-spawn as a different type (heal or damage note). The chance that it can spawn as either can be set by me in the Game manager.
Dirty Stop Out
Status | In development |
Author | marshmllow |
Genre | Survival |
Tags | 2D, Comedy, High Score, Minimalist, Real-Time, Touch-Friendly, Unity |
More posts
- Dirty Stop Out | Construct 3: Part 1Jun 10, 2019
- Dirty Stop Out | Week 3: Wierdos, Timer, Health, MusicJun 07, 2019
- Dirty Stop Out | Week 4: Saving & Loading, VFX, DeployingBuildJun 07, 2019
- Dirty Stop Out | Week 2: Dancing, Game Over Screen, Health NotesJun 07, 2019
- Dirty Stop Out | Week 1: Framework & DevelopmentJun 07, 2019
- Dirty Stop Out | Week 1: Brainstorming & MockupsJun 07, 2019
Leave a comment
Log in with itch.io to leave a comment.