Devlog 1 - And so it begins (first night, August 1st)
Hello everyone. This is the first of many devlog posts. I had the idea coming into this jam that I would be doing a beatemup, akin to Double Dragon or Streets of Rage. Story? No, none so far. :P For the most part, I try not to have any intentions in art, story, and honestly normally even the game genre. I tend to a bit more on low rez jams as normally I work on them on my own. This year, I have RyanAvx helping me with audio, so I shouldn't have to use random tracks from random asset packs from random humble bundles this year, so that will be nice. Anyway, ONTO THE LOG!
So it's the first night. I made a unitypackage before the jam to just drag a camera in and have it just work. I did find a problem though. I made a script to keep everything on pixel units. This works ok in some cases, like things that don't move, but on things like cameras or players, you have to move at a specific speed or higher, so I had to remove that script from all the prefabs and such before I could really move on.
The Start (Art)
I started with a smidgen of art just as a mockup on a 64x64 pixel canvas.
This took all of about a half hour. I do art, I am not an artist, and as such I don't do this all that often, so I can be a bit slow with it sometimes, and others I can be fast. After making the mockup, I made a very simple character placeholder. While I intended them to just be a placeholder, I am starting to like them more and more. I also made a trash can for sizing and testing reasons. May get modified to be a bit more fancy, like popping out pieces of trash when hit/destroyed.
Start of a world (basic code and art in the scene)
At this point I threw in some code and had walking and a basic camera movement.
A problem with trash
As you can see, there is a problem with the trash can. It kind of wobbles instead of staying in place. This took a fair amount of time to track down what had happened. In preparation for animating it to take damage, I had changed the pivot point. What you are seeing is the fault of bad subpixel alignment. This trashcan is not save in a multiple of 8, which is my pixels per unit. Since it was 18 pixels tall, I had just dragged the pivot up a little. Problem is, as shown in the gif, this means that it's off by a percentage of a pixel. What I ended up doing was making the image 24 pixels tall and just having the extra transparent pixels be above it. After that, I could do math to figure out the pivot point. I have to do this math, because Unity doesn't set it's pivot points by pixels. it does it by percentages. So I have math. (24 pixels tall / 8 pixels per unit = 3 units total, 1 unit / 8 pixels means a pixel i .125 units tall. To get the percentage for the pivot I just need to divide 1/3 to get the scale of a single pixel tall, and multiply that by how many pixels I want to move it in unit sizes. So, .33333 * .125 = 0.0416)
So now I have the number and it's simple to move the pivot to the right pixel. Just multiply 0.0416 by the number of pixels I want to move the pivot. Anyway, that fixes the trash can and I now have this.
At this point, I took an hour or so break. I had to work today, and I program as my day job, so I'm a bit worn out at this point. (time invested, about 2-2.5 hours) After watching a few videos and getting some food, it was time to return. I decided to start with a swipe animation and make attacking the trashcan possible. So I made a few generic scripts. "DamageDealer.cs", "SimpleWorldObject.cs", and "SendCall.cs". Damage dealer, as you can imagine is a script that deals damage. I try to make scripts as generic as possible.
Damage Dealer (script)
The DamageDealer is put on an object with either a trigger or a collider (normally trigger) and has the option of dealing damage to either a player or enemy or both, and on trigger enter or collision enter. With this, things like the player's punch/swipe/anything can simply have this script thrown on it and it activated when attacking. This can also be put on things that are still, like spikes. It also works with animations, so you can have something like an explosion happen, and in doing so, you can change how much damage it does from the start to the end of the animation. Things close to it get hit by full damage, things further away get hit by low damage. It's all up to the animation system or just what you leave it at default. I probably won't be using ANYTHING but this damage dealer.
Dealing damage with Simple World Object and Send Call (scripts and animations)
A simple world object is going to be anything that's in the environment that doesn't do anything complex. I started by adding this simple world object script to the trash can, adding an animator, and making a simple animation to take damage. At the end of the animation, an animation event trigger was added to call a function that allows the object to take damage again. The problem is, I moved the position of the trash can in the animation editor, and it wasn't a child of another object. This means the animation moved the trash can to wherever it was when I animated it instead of using local space whenever it took damage. Not a big deal, right? Make a child object, copy the animator and sprite renderer components to the new child, delete them from the parent. Animation plays correct! BUT the take damage function is on the parent now... You can't call the function of a parent with an animation trigger event like that. THUS SEND CALL! Send call is an EXTREMELY simple script. I calls the command SendMessageUpwards and takes in a string. When the event is triggered it calls the function on any script going up the line of parenthood. This means it can call the ResetTakeDamage function, and better yet, doing it on any script means if I make an AI script and it handles the health, as long as I keep the same function naming convention, it will still work! Generic scripts are great, aren't they?
Swipe Right! (putting it all together)
After completing the code to deal the damage, and accept the damage, I had to make a little placeholder swipe animation.
Now the player instantiates a game object of the swipe, it animates, the animator calls the destroy function on it using the send call script. Everything is now good to go!
The Day's Summary
This is now the ending point of the night and I have a basic character that moves, animates, and punches, a basic environment to walk around in, and something to hit (the trash can) and kill. This segment also took 2-2.5 hours, so the total time at the moment is around 4.5-5 hours of effort and an hour-ish to write this blog. Anyway here it is in action!
Yeah, it's not a game, but it's a GREAT start for the first day in a jam. Especially since I did the art and the code on my own. Comments or suggestions are appreciated. (I do these write ups and never know who reads them) Should I keep the little spirit as the main character? Does the speed look good? Etc. Anyway, thanks for reading if you did!