GameMaker: Studio

GameMaker: Studio

Find, play, and make games easily
Discover, rate, and download the best player-created games made in GameMaker: Studio for free. Or try making your own and share with the community. Click here to learn more.
Blu_Monster Nov 5, 2012 @ 10:41pm
need ideas
hello im working on a game where you have to deffent your base from enimes while they spawn
and the enimes can shoot but i want them to be able to shoot at me but not allways hit because its unfair if they hit you allways and you might not allways hit them back
< >
Showing 1-4 of 4 comments
Lots of options for this. Here are some ideas:
  • When a bullet hits a player, check a random number to decide whether or not it causes any damage. Otherwise deactivate it somehow.
  • Fire two kinds of apparently identical bullets randomly. One kind can do damage, the other is just for show (e.g. no collision with player).
  • Fire bullets in a slight spread, so not all of them are perfectly on target.
Blu_Monster Nov 9, 2012 @ 5:25pm 
thanks you are a big help
Scorcher24 5 Nov 25, 2012 @ 10:54pm 
What you can do is giving the angle a little variation when they shoot at the player:

var shoot_dir;
var new_shot;

shoot_dir = point_direction( x, y, objPlayer.x, objPlayer.y);
shoot_dir = irandom_range( shoot_dir - 10, shoot_dir + 10 );

new_shot = instance_create( x, y, objBullet );
with ( new_shot ){
speed = 15;
direction = shoot_dir;
image_angle = shoot_dir;

What this does is getting a random number based on the direction of the player. This way you either land a full hit or shoot slightly next to him.
I use this in my game Space Potatoes and it works fine imho.
wer2chosen 2 Apr 5, 2013 @ 4:50pm 
YThe random idea is a great one. Youu can also created an array and use it similarly as to wargames. This is helpful if you want to take into account distance, skill. So each attacker has a skill variable, you have a defend variable. Roll random number, apply the bonuses or detract , check if hit. Then use animation(s) based on results. Hit or miss.
< >
Showing 1-4 of 4 comments
Per page: 15 30 50