How do you make an enemy object shoot in game maker 7?

1 answer

Answer

1066368

2026-05-09 11:20

+ Follow

this is the code I always use:

bullet = instance_create(obj_enemyBullet);// create the bullet and store the ID in a variable
with(bullet){//start running code in the bullet
parentID = other.id;//set the enemy ID that is the parent to the bullet as a variable in the bullet
direction = (parentID).bulletDirection;//set the direction to a variable stored in the enemy
speed = (parentID).bulletSpeed;//set the direction to a variable stored in the enemy
//etc.
}


obj_enemyBullet is the object name of whatever the the enemy is shooting
bulletDirection is a variable in the enemy that contains the direction the bullet should move
bulletSpeed is a variable in the enemy that contains the speed the bullet should move
just copy/paste this code into the event that triggers the bullet firing and account for the mentioned variables. Credit Dr. Sakuya

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.