Grindin on basic game mechanics

This week I learned some more basic game mechanics as I prepare to start iterating prototypes of my first big game project-

I already have some basics like-

Run, jump, push objects, fire projectiles at enemies, melee attacks, player life/item management, use bombs that damage things based on distance, basic enemy ai....

The things on this weeks list were-

Freeze Ray- something like the ice weapon in Megaman 1 as it can freeze level elements like fire and water as well as freeze enemies for a limited time

This freeze water I did this in Playmaker...

So to freeze a pool of water that the player would fall through by default I just added a trigger event so that when the projectile tagged "icebeam" collided with the water it moved it into the freeze state- the freeze state switches the water from the water material to the ice material and turns on the box collider for that object and sets a timer of 6 seconds- so when hit with the ice beam it turns to ice and now the player can walk on it for 6 seconds- then the unfreeze state reverses what the freeze state did

To freeze an enemy in motion I animate a cube to standin for my enemy and did this...

I set a trigger event so that when the enemy is hit with the projectile tagged "icebeam" it goes into the freeze state-The enemy uses the Mecanim animator system for its animation so the first thing I did was use set property to disable the animator component- this stops the enemy animation- the enemy has a rigid body tag so that when you disable the animator physics take over and it falls to the ground- I wanted it to freeze where it is so I used set property again on the enemies rigid body tag and I set it to freeze all constraints- so now the physics system can't make it move/rotate anymore- then I change the material to a frozen material and set a timer to unfreeze after 6 seconds- the unfreeze state reverses the freeze state...

This works really well BUT if I was using Rain AI or another pathfinding/AI solution to control the characters movement I'd have to add another action in there to pause or switch that off- I have to figure out how to do that for the game so more work needs to be done on the freeze ray...

I saw a video on youtube where someone made a hookshot from the Zelda series so I wanted to figure that one out as well- I did a super quick crappy hookshot mechanic using a trigger and the iTween "move to" action like this...

So I had the player fire a projectile tagged "hookshot" and stuck a trigger on the object to be hooked onto- when hit with the projectile it goes to the hook state which uses "Move To" to move the variable "Player" to the position "hitch" which is an empty game object sitting in front of the object to be hooked onto so that the player doesn't try to penetrate the hooked to object- much to my surprise it worked really well- I'm constantly amazed how simple and fun it is to work with Unity and Playmaker...

The latest thing I wanted to figure out was a basic magnet system or the appearance of a magnet system- it doesn't have to be a real magnetics system which are sold on the asset store here and here I just wanted to fake it...BUT even if I had to buy them its only $12 for BOTH.... I ended up using the "explosion" action for the repel and the "move towards" action for the attraction- it works really well making the player stick to or be repelled from my "magnet" objects...

Initially I was having a hard time with this one as I went for a more accurate and complicated route using some equations I found on the Unity forums which used a Vector3 direction- I was trying to use this as part of my repel solution to find the direction to repel the target in....
  1. Vector3 dir = (target.transform.position - transform.position).normalized;
I was able to convert that to playmaker actions but I couldn't get to work right- I was going to buy one of the magnet system assets when I found an easier solution on the playmaker forums- using an Explosion action with the "every frame" function- I did everything I needed to repel the player so I used that...


This stuff I'm doing is really simple compared to thing I've seen other people doing but much to my amazement it works really well for what I want to do... I'm sure it much faster if you do it with straight code rather than FSM's like I am BUT I'm going to keep my game fairly simple- I'm not going to have tons of enemies on screen at all times... 

If you want to get into game development but you haven't because you think it's to difficult...IT IS NOT! This basic stuff like I'm doing is SUPER EASY when you add Playmaker to Unity3d so check those two things out if you want to get started!

So the next stuff I have to figure out for my first game prototype is...

- roll/dodge action for the player
- Have the player run by default and walk with a button press
- charge blast

So seriously this stuff is fun and easy! Get Unity3d and Playmaker and start making your games!

and

If you want to talk game dev with me add me on skype! I'm "mdotstrange" on there ^_^

Comments

Post a Comment