Sunnyside Smash Dev Blog 1
So after buying it I figured I'd just put it together into Construct and see what I could make of it. Also decided to stream it on Twitch - a little live GameDev action.
It didn't go great but eventually got something thrown together that you can play below. Below that is the stream video and then screenshots of the Construct event sheets with a short explanation of each.
Hoping to add a bit to this, something as simple as keeping score and smooth restarts, and any other small tweaks to make it a bit more playable. Wanted to post this before making any further changes not from the stream, in case anyone wants to use this like a tutorial.
Here is the project after the first game dev session. You can play below, here on this page, but annoyingly the arrow keys will move the page up and down on some browsers.Click here to open the above game in a new window
If playing in a new window you shouldn't have to worry about the arrows scrolling the page.
Simply use the arrow keys to move and space bar to attack. Smash as many people as you can without getting smashed yourself. If you do die, you will just have to refresh the page. Yes, so many things to add to get this in a good state.
Uncut GameDev Stream
Here is the un-edited stream where I made the above. I am not sure if it is worth watching it all unless you are really looking for how something was specifically done.
Objects in Project
I thought it would make sense to first overview the objects used in the project. That way looking at the event sheets may make more sense with less explanation.
- boom: (sprite) A sprite spawned during an attack animation. It is never visible, only used for it's ref box to check for collisions
- door: (sprite) The door for the houses, as the animation changes, from open to closed, when character moves over door
- house: (sprite) Sprite used for the houses. Used sprite over tilemap to give more flexibility with z index.
- Keyboard: (plugin) Project plugin to allow for keyboard input.
- personAnimation: (sprite) sprite set to playerBase's position but holds the animation for the character, besides hair and such.
- personBase: (sprite) Sprite which does not have animation and not visible, to keep a static ref box.
- playerHair: (sprite) Sprite to hold hair animation and always set to playerBase's position
- tilemapBG: (tilemap) Tilemap for background decorations, which currently only includes grass and the pathway.
The families are also shown in the screenshot above, which is only the family called zindex. I can simply add any sprite that I wanted sorted with the zindex to this family and nothing else needs to be done.
Master Event Sheet
The master event sheet is the one connected to Layout 1. All other event sheets are included on the master sheet, therefore only serve the purpose of orginization. Also, the master event sheet acts as a catch-all.
- Lines 1-6: Setup events, such as creating 50 characters, scrolling to the center house, and setting up one character as player controlled
- Lines 7 & 8: Open a door if character overlapping it
- Line 9: Function to create a person, used at start of layout and future creations
- Line 10: Calls functions for z index
- line 11: Creates a person every half second
Animations Event Sheet
The animations here deal mostly with mirroring depending on which direction they are moving as the walk animation simply loops. The second half here deals mostly with the attack, so might have made more sense to put it on the attack event sheet.
- Lines 1-8: Loop to determine whether each character should be mirrored or not
- Line 9: Player controlled character, which is determined by the one with 8-direction enabled, attacks when space pressed
- Lines 11-13: Looks for the frame in the attack animation that impact occurs and creates a boom object
- Linse 15-16: Kills any person that is overlapping with the boom object
- line 18: Destroys the playerBase once death animation has finished
Attack Event Sheet
An attack function where you can pass it any personBase UID. Also, the event that watches for an attack to finish to return to the walk animation.
- Lines 1-2: Starts the attack animation on whichever uid is passed to the function
- Line 3: After attack animation is finished, switches animation to walk so it doesn't stick in the final frame of the attack animnation
Pathfinding Event Sheet
Pretty simply pathfinding here by using random numbers.
- Line 1: Pretty typical, when path is found start moving along the path
- Lines 2-3: After person stops moving I want it to attack. Then a slight delay, partly to let the attack animation finish, before starting to move again
- Line 4: If path is not found, so that they don't exit the above loop, have them attempt to find a new random path by starting the timer. Using this timer also allows the re-use of code.
- Lines 5-6: On timer, loops through all characters for which the timer went off so that they don't all go to the same location, and simply finds a random location on the layout
Z-Index Event Sheet
Sorting the zIndex of characters, houses, and the doors in the z index family.
- Lines 1-3: The sort zIndex built in functionality in Construct needs to be sorted by a family instance variable. So I simply created an instance variable and set it to their Y value each tick. Then they are sorted based on that instance variable.
- Lines 4-5: After sorting the z index above, I make sure each character is stacked correctly. There could be a way to include this kind of sorting in the function above, but I preferred to explicitly set it here.
If you enjoyed this shoot me a comment on one of the socials below. If you would like a mini-tutorial on one of the mechanics I might be able to do that. Or if you enjoy playing and looking forward to see those edits - let me know! It might push it up the priority list!