answersLogoWhite

0

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

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Other Math

Is there an internal variable for an object's speed in Game Maker?

Yes, the internal variable for an object's speed in Game Maker is <Object_Name>.speed.


How do you give an object a vertical speed in game maker 7?

use the action with the big up arrow


How can you make an object avoid another object in Game Maker?

To make an object avoid another object in Game Maker, you can use the built-in collision detection functions. In the object's step event, check for the presence of the target object using place_meeting(). If a collision is detected, calculate a direction away from the target object using point_direction() and move the object in that direction using move_towards_point() or by adjusting its position based on the calculated angle. Additionally, you can implement a distance threshold to trigger the avoidance behavior only when the objects are close enough.


How do you make an object follow another object in a Game Maker game?

objectfollow = name or id of object to follow. spd = speed to follow. { if collision_point(self.x,self.y,objectfollow,true,true) = false { mp_potential_step(objectfollow.x,objectfollow.y,spd,true) } }


What game maker action allows an object to have more than one sprite?

In GameMaker, the action that allows an object to have more than one sprite is the "sprite_index" property. By changing the sprite_index of an object during runtime, you can dynamically switch between different sprites based on game logic or events. This enables the object to display various visual representations, such as animations or different states, enhancing the visual experience of the game.

Related Questions

How do you make a sprite shoot in game maker 7?

A sprite cannot do anything. If you meant "How do you make anobject shoot in game maker 7?" then it's easy.Create an object for your bullet and give it a sprite. Then in the object you want to shoot the bullet add a "create instance with motion" actionwith the bullet specified.Alternatively you could use a "create instance" action and then add an on creation, "move" action to the bullet.


How do you shoot a laser on game maker 8?

To shoot a laser in Game Maker 8, you can create an object for the laser and use the "keyboard_check_pressed" function to detect when a key is pressed to shoot the laser. Then, use the "instance_create" function to create instances of the laser object at the desired position. You can set the speed and direction of the laser object in its create event.


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

Depends. You could have it make a new object, for bullets as an example, you could have it make a line, for lasers as an example, you could have it do all sorts of things.


Is there an internal variable for an object's speed in Game Maker?

Yes, the internal variable for an object's speed in Game Maker is <Object_Name>.speed.


What kind of game is Castle Defense?

The game "Castle Defense" is a simple online game, where there is no need to download and has an easy interface. The object of the game is to defend your castle by buying different types of tanks to shoot the enemy.


How do you make a player shoot in a Game Maker game?

Create a bullet object and then use Create Moving Instance (I think that's what it's called)Should hopefully soon be merged with How_do_you_make_a_player_shoot_in_a_Game_Maker_gameUntil then, check out the answer over there.


How do you make a sprite shoot in game maker?

A sprite cannot contain code.


How do you make an object in game maker come towards you when you get close to it?

To make Enemy go towards Player when in range. For Enemy object: On step: Execute Code: if(point_distance(Enemy.x,Enemy.y,Player.x,Player.y)<RANGE) { move_towards_point(Enemy.x,Enemy.y,SPEED) } (Replace RANGE with the range and SPEED with the speed)


How do you make your sprite shoot in game maker 7 if it has turned?

by doing programming and cordial


How do you make a player shoot in a Game Maker?

Create a bullet object and then use Create Moving Instance (I think that's what it's called)Should hopefully soon be merged with How_do_you_make_a_player_shoot_in_a_Game_Maker_gameUntil then, check out the answer over there.


How do you make an object pick something up in a game maker game?

Je moeder is gay.


What is the goal in the game Tower Defence?

The goal of Tower Defense is to stop the enemy from crossing the map. This is done by constructing towers to shoot the enemy and traps to slow the enemy down.