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
Yes, the internal variable for an object's speed in Game Maker is <Object_Name>.speed.
use the action with the big up arrow
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.
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) } }
In the step event, add a move towards action and put x as object1.x. Put y as object1.y. Enter the desired speed below. Of course, this is only an example and you would have to replace object1 (in both places) with the name of the object to be followed.
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.
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.
Yes, the internal variable for an object's speed in Game Maker is <Object_Name>.speed.
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.
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.
A sprite cannot contain code.
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.
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)
by doing programming and cordial
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.
Je moeder is gay.
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.