Shooting behaviour

Is there any ways I can make the bullet to be created infront of the shooter rather than creating it in the centre of the shooter?

Yes. Just make new image point “shoot” (or whatever you want to call it) in front of the shooter and create object to that point. Or you can create object to the player.X(Centre) +10, player.Y(Centre), But creating new point should be better and easier to handle.

Also, this only works if the player can’t rotate/flip, otherwise you’ll have to deal with point rotation:

RotatedPointX = PointX*cos(angle) - PointY*sin(angle) RotatedPointY = PointX*sin(angle) + PointY*cos(angle)
With PointX and PointY the point to rotate, relative to the pivot point of the player (the player rotates around this pivot, usually the Centre point)

So… add sprite points is the only feasible/practical solution :smiley:

So how do I use it?

Like that :slight_smile: You can create image’s points and when you want to create something to that point, use that point name between (). Like in that picture, image point name is “Shoot” and I create object “bullet” to that point so Player.X(Shoot) and Player.Y(Shoot).

So is it possible to make the point rotate?

It rotates by itself :slight_smile: Are you making topdown shooter and player can turn 360 angle? Try those events what is in the picture.

Just to clarify, the points you add to the sprite object are attached to the sprite, so they will be rotated with the sprite. If you add the point GunBarrel to the Weapon sprite object, no matter where the weapon is or its angle/scale, the expression:

Weapon.PointX(GunBarrel); Weapon.PointY(GunBarrel)

will return the position of the point, so you can do:

Conditions: Left mouse button is pressed Actions: Create object Bullet at Weapon.PointX(GunBarrel); Weapon.PointY(GunBarrel) Do = Weapon.Angle() to the angle of Bullet Add a force to the Bullet with angle Bullet.Angle() and force 500
Hope it helps :slight_smile:

Just wanted to add that objects seems to generally be created at their own “Origin” point, positioned at whatever point you specified them to be created at. If you use large projectiles that becomes very apparent. Took me two hours to realize and fix that. :neutral_face: