Welcome to Dino's dev blog fun time spectacular! Where game makes you! Following the release of Aftermath Y2K; I've been doing a lot of protoyping. Trying to come up with some ideas to pursue for full game development. I had an idea for a game that involves a character who eats food that in turn gives them some sort of power. I.E. if you eat a spicy tuna roll your character gains a fire breath ability.
It'd be some weird Kirby, Megaman, Metroid hybrid. However I'm kinda stuck with that idea for now so it's on the ol' backburner. Where games go to die. Anyway in the meantime I've come up with a short one/two month project. Now I've spent a couple weeks putting a solid engine in, and now it's time for some design choices.
The game is simple a mixture between Smash Bros., Wario Ware and Dodgeball. What does that mean?
Well the game is a competitive arena platformer. However each game is comprised of micro rounds. The target is to have each round last around 10/15 seconds. Each round will switch stages after each round is complete. The stages will have a similar variation to those in a game like smash brothers. Some will be flat with nothing. Others will have numerous hazards with a lot of verticality. I'm not sure how many stages I'd like but for now that isn't important. Who knows maybe I'll open stage design to the community, that'd be fun. Lastly the Dodgeball part is pretty simple. The game is basically Dodgeball. There's one ball and you have to hit your opponent with it. Also there will be powerups/items. So now that you have some context that's move on to the actual topic.
The Problem: How to handle ball possession.
On the surface it may seem to be a rather simple solution. Just set the XY values equal to that of the players when the player has possession of the ball. However this really doesn't work for a couple of reason. I'm using Game Maker's built in physics engine. This engine isn't really meant for directly editing the XY coordinates of an object. However the work around for this is pretty simple. All you have to do turn off the physics on the object temporarily then after throwing the object turn it back on.
However the bigger issue is that by just setting the ball to XY coordinates you're left with this awkward floating ball on top of a moving player. No big deal just offset the sprite right? Well not exactly because the animations of the sprite(2D image), and the ball's sprite do not align when the sprite is animating.
So what do you do?
Well here's the great thing about game design, there is no one right answer. In fact there are many ways to handle this situation. You could just ignore the issue. Of course this will look like crap, but it works. You could change the theme of the game to sci-fi and have some sort of gravity glove that causes the ball to float in front of the player. Thus the animations won't matter. You could also change the theme to magic or telekinesis or whatever. However I don't want to do that. I kinda want my game to have this 80's sport vibe. Or maybe I'll go super nuts and have a game with spacemen, dinosaurs and pirates because I can that's why!
(See how it moves. A static ball won't move with it, and would be real odd looking.)
(Here's a little onion skinning to better illustate how much the arm moves.)
I think the best two options are as follows:
Move the ball object to match the sprite.
Or have another set a sprites for when the player has the ball, and when the player does not have the ball.
Let's work with the first solution:
This is probably the easier of the two options at first glance. The advantage of using this method is that
you won't need to create new sprites for every character in the game. The ball will automatically move via code, along with the player. HOWEVER this means that that every sprite will need to have the ball hand in the exactly same position for every sprite. Basically leaving you with cookie cutter animation. As predominantly an animator I have an issue with this. Animation can tell a story. Through it you can convey a lot about a character's personality and self being. In a game like this, where voice dialog will be non existent you need to take advantage of every opportunity to give personality to a character. Just look at Carpet from Aladdin. Has a ton of personality but has 0 lines of dialogue. But why give multiplayer character's personality? Who even cares? You do silly! Whether you realize it or not. Have a look at games like Overwatch, League, TF2, Smash, etc. Players grow to love character's with strong personalities. I mean there was Overwatch porn and fan art long before Overwatch was even launched. People were Overwatch fans long before most people had even played it. That attachment means more sales, more success and more longevity for your game. These are things you want and why personality is very important. So then, is this solution off the table then? No, not necessarily. You could always create a new set of coordinates for every animation of every character. However for me that seems like a lot more work than it's worth; BUT for someone else it may not be. On top of this it's worth noting that you'll need to have the arm of the sprite drawn separately from the rest of the body, to appear on top of the ball. So the second solution may even just be the objective better choice.
My solution is the second. It's very simple and very effective, and by avoiding code we can avoid things like bugs and glitches as a result. Especially because I am not a super competent programmer :P.
To execute this plan all we need to do is have a boolean(true or false statement) occur. If the player has the ball then use one set of sprites, if not use the other set of sprites. Then it's as simple as duplicating each sprite and photoshoping the ball in. Super easy, simple, and clean. The only downside is that this method will add to your games file size. As I am only using 64x64 sprites, this really won't be a huge issue, but it could be if you were to use say 256x256 sprites, or something bigger.
Anyways I hope you find this little blog enlightening. Thanks for reading :).