0 Favourites

Laser Bullet

  • Hi,

    I´m new here, I´m doing my first game using Construct 2 and I have a lot of doubts, I read some tutorial, but I don´t find how to produce laser rays from my gun?

    Hope you guys help me out to solve it

    Thank you

  • Assuming you have your gun sprite and laser ray sprite ready to use:

    You can create an origin point on the muzzle of your gun using the image editor [ besides the default origin point which determines the reference point of the whole image (commonly left in the middle of the image)]

    after creating the additional image point, you can refer to it in the events page. lets say your gun is called sprite_gun, and you have the origin point for the image, and you also added an origin point for the muzzle of the gun. these image points will be 0 and 1 respectively. Your laser ray is called sprite_laser

    After that, just create an event that creates your laser ray from your gun muzzle and imparts a force on it (or use the bullet & physics behaviours for your laser ray)

    example

    mouse: on clicked; [/code:3g81g27u] - condition
    action - [code:3g81g27u]system: create sprite_laser at position sprite_gun.ImagePointX(1),sprite_gun.ImagePointY(1) and angle sprite_gun.Angle[/code:3g81g27u] (the ImagePoint (1) refers to your gun muzzle, the angle ensures the laser appears at the correct angle according to where the gun is pointing)
    action - [code:3g81g27u]sprite_laser: Impart physics force of 20[/code:3g81g27u] (makes the laser shoot forwards)
  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Thank you

    Let me try this

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)