Reset Turret rotation.

Get help using Construct 2

Post » Fri Feb 10, 2012 4:18 pm

2 things i want to learn next.

1. How do i reset the angle of my turrets when out of range?

Once my turrets are out of range, they should reset their position, not so hard for placed turrets. But what about those i have Pin'ed to my ship?

I have tried with Imagepoint's of the ship. But since the ship is moving, the turrets kept rotating.

I need to somehow rotate them back to default once they are out of range.


2. Make turret only fire when Target is within angle.

Again.. not so hard for standing turrets, but no clue for the ones on the moving ship since the image-points and angles change while moving.









Game

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Feb 10, 2012 4:46 pm

You can try this:
turret behaviorFimbul2012-02-10 16:46:59
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Fri Feb 10, 2012 5:16 pm

Nice. Trying it out right now :)

Can't seem to get it to turn yet.



Still i am open for other ideas as well


This might fix   NR 2. but not NR 1.   

Because it does not solve the Movement problem.

Also i still need to turn the turret back to it's start position, "rest" is not doing that for me... what exactly is "rest" for?Schoening2012-02-10 18:00:09
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Feb 10, 2012 8:00 pm

When the turret has no targets, it returns to it's starting position.
Is that what you want?
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Fri Feb 10, 2012 8:38 pm

[QUOTE=Fimbul] When the turret has no targets, it returns to it's starting position.
Is that what you want?[/QUOTE]

No i can do that with a event.
I want it to Rotate to the Start Position Relative to the ships Rotation.

Cool as it is, i don't think your Turret Behavior can do it..
The Heading and Arc can't be changed in events.



See what i mean? The rotate back is one thing.. Mostly Cosmetic.
But i REALLY need the turrets Aim Area to Follow the Ship.

I think i need another way to do it
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Feb 10, 2012 10:08 pm

Just add the ships angle into the equation.

The usual setup is to have "right" as an angle of 0.
So the turret angle range would be:
Ship.Angle+45 to Ship.Angle+135

Then to reset the angle of the turret like your image set the turret's angle to Ship.Angle+90.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Fri Feb 10, 2012 10:22 pm

If I'm understanding the problem correctly you could try taking the ship's current angle and subtracting 90 degrees. So, when you want to go back to default you would set the angle of the turret to Ship.Angle-90.


Regarding your second question, you just need to add a condition to your firing event that checks to make sure the enemy is within a certain angle of your ship's. Here's a snippet of code from a project I'm working on that seemed to work.



B
8
S
3
G
4
Posts: 22
Reputation: 2,717

Post » Fri Feb 10, 2012 10:33 pm

@R0J0hound

Sadly i can't take Ship Angle into the Equation in the Turret Behavior.
But i will just create my own Turret with Events :)

@R0J0hound
@Mastasurf

I will try out your ideas, thanks a lot
I just find it weird that i can't simply make it face a ImagePoint..
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Feb 10, 2012 11:19 pm

First part done :)

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Feb 11, 2012 2:04 pm

I could add "bind to object at point" as an action, but that would be deprecated by the container feature.
I'll resume working on the turret behavior on monday, and I'll see if I can add something to the extension or code a "hardpoint" behavior that attaches objects to other objects (while keeping angles relative)

Meanwhile keep this topic updated, my goal is to have the turret behavior be able to do everything you want.Fimbul2012-02-11 14:06:38
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jeffige, LeFuji, plinkie, Radulepy and 0 guests