Greeting Construct users,
I am searching for hours a solution to make a rotating laser cannon to throw a single dotted line of laser, but I can't find the solution. and secondly the laser doesn't shoot straight and I don't know why. This is a picture of the code below. I would like to know if someone doesn't have a suggestion. Thank you!
Check out that link,its a lazer tutorial from someone using contruct 2
It doesn't work because the tutorial doesn't help me to do what I want to do. I will resubmit my question so you are someone else can provide me with a code or a tutorial that will help me.
Thank you anyway!
Applying a physics force will just push it, you need to set angle of the projectile toward target.x,target.y. The target isn't even mentioned here.
I am supposed to include target.x,target.y? Can I have an example for the complete expression?
Now that I think about it, what are you doing here? It's a side scrolling game that fires a laser upwards and the bullet is a physics object? So it's like something from the game Worms?
No, I am trying to fire a bullet upward like a normal projectile.
I am struggling with the laser cannon issue for three days.
Develop games in your browser. Powerful, performant & highly capable.
The laser might not fire straight because you use physics and physics has gravity. You´ll need to use the set world gravity action (set to 0) if you want the laser to not be affected by it.
But it´s a bit unclear what you are trying to do exactly.
do you mean something like this?
Have you looked at the Instant hit laser example?
Yes, something like this. A turret that fires in the direction of a target. By the way, I already used the Turret behaviour and it doesn't work. When the player sprite approaches the turret, the cannon is moving away from the turret. So I will use the example that you sent me and if it doesn't work I will write you back.
I used the example that sent me in the link that you have submitted in the Forum. But unfortunately, it doesn't work. The turret is moving away from the player when I move the player in the direction of the turret.
Thanks! I changed the angle of the projectile and I use the code in the example that you sent me and now it finally works! Thank you tunepunk and thank you to all the others who suggested me other options!
Do you remember the link that you provided me (dropbox.com/s/cktagro3h7ygvs0/lazer_cannon.c3p)? Let's say I want to have another Turret that fires on the opposite side of the screen (to the right). How can I reverse the code so the turret can shoot in the same manner but from the right side of the screen? This is an image to refresh your memory: