Showing posts with label gamemaker. Show all posts
Showing posts with label gamemaker. Show all posts

Wednesday, January 11, 2017

Gamemaker tips for top down shooter

I have played around with Gamemaker for sometime and heres few tips for top down shooter.


1. Movement


I like to movement towards cursor and with WASD keys so here is how i did it.

W

move_towards_point(mouse_x,mouse_y,speed);


speed should be positive because you should move towards mouse cursor



S

move_towards_point(mouse_x,mouse_y,speed);



and here speed should be negative example -20 so char would walk away from cursor



A,D keys should not be done with this and i think they should just be strafe, so postive and negative speed on x-axis



2. Weapons, shooting and switching



I like to do this with scripts and just switch the shooting script



On your hero,char,shooter you would have

Equipped variable and to that you can store script

example

Equipped=pistol;



on mouseleft or your shooting key you just execute Equipped

script_execute(Equipped);



on a pistol script you create bullets and shoot



3. Switching weapons



So if do switching with 1,2,3.... keys, you can just make that key to switch

the Equipped script



example when 2 is pressed

Equipped=Shotgun



example when 1 is pressed

Equipped=Pistol


Now when 1,2,3... is pressed it changes the script what mouseleft then executes.

4. Gun with kick

So at shooting script (Pistol,Shotgun)script i have the shooting and movement... yes movement so the gun will have a littlebit of kick

example in shotgun
move_towards_point(mouse_x,mouse_y,speed);
and speed should be negative in this one so it moves away from cursor