# How I Can Make A Enemy A.I In Game Maker

3 replies to this topic

### #1 TheLastSurvivorFPS

TheLastSurvivorFPS

GMC Member

• GMC Member
• 13 posts
• Version:GM8

Posted 25 August 2010 - 11:30 PM

Hello, im TheLastSurvivorFPS and i have one question.

Im creating a platform shooter and i programmed this.

The Player has a 9 mm, the player only can shot 2 bullets every second
Gravity and puzzles

but I have some troubles:

The Enemy ever follows the player and it ever stay in air floating, i put gravity to the enemy but, donīt work
The Enemy ever shots (but no at the player)

I Want to do this

- the enemy have a machinegun, i want when the enemy shots 30 bullets needs reload
- the enemy shots at the player
- when the player walk near the enemy shot at the player and follow it (no floating)
- when the player is not near the enemy, it stop shooting and stop follow the player

• 0

### #2 wai0001

wai0001

GMC Member

• New Member
• 162 posts

Posted 26 August 2010 - 12:36 AM

for the gravity put

if place_free(x,y+1)
gravity=.5
else
gravity=0

for the following put
if !(collision_line(x,y,obj_player.x,obj_player.y,obj_wall,0,1))
{
if obj_player.x<x
x-=4
else
x+=4
}

Edited by wai0001, 26 August 2010 - 12:36 AM.

• 0

### #3 TheLastSurvivorFPS

TheLastSurvivorFPS

GMC Member

• GMC Member
• 13 posts
• Version:GM8

Posted 26 August 2010 - 02:02 AM

tanks wai001, it helped me a lot!
• 0

### #4 CaptainLepidus

CaptainLepidus

GMC Member

• GMC Member
• 850 posts
• Version:GM:HTML5

Posted 26 August 2010 - 04:45 AM

http://gmc.yoyogames...howtopic=346470 might help with the enemies.
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users