How do I create enemy tank w/turret behavior?

Get help using Construct 2

Post » Wed Jun 25, 2014 6:10 pm

I want an enemy tank with a turret that targets player objects.

What I can't get is the turret to turn

'base' of turret is container

Code: Select all
base on created --> turret1 pin to base (pos & angl)


*base has bullet behavior and it's path set

*turret1 has bullet, turret behavior (enabled)

Code: Select all
turret1 on created --> turret1 add turret target player


It will shoot at player but turret does not spin
B
8
S
2
G
2
Posts: 34
Reputation: 1,707

Post » Wed Jun 25, 2014 7:10 pm

I don't really understand the way you explained the tank object but i would go about like this...

Make a tank body. Use the body as a base sprite.

Next, make the turret and pin this onto the tank body in the correct place and add the 'pin-to' behaviour and 'turret' behaviour.

Pin the turret to the tank but only set it to 'pin to position' not angle. This will mean that the turret will follow the tank body but can rotate at it's own accord.

This does mean that when you turn your tank you turret won't rotate but, if you want, you can sort this out by pinning the turret (position and angle) to the tank body when the tank is turning and then just pinning the turret (position only) when the tank is not turning!

Hope this helps!
B
5
Posts: 20
Reputation: 519

Post » Wed Jun 25, 2014 8:41 pm

SquareMation wrote:
Code: Select all
base on created --> turret1 pin to base (pos & angl)

It will shoot at player but turret does not spin


That's the problem, right there...

pin to base (pos & angl)

If you want your turret to be able to turn independent of the base, you must pin it position only.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
15
S
3
G
1
Posts: 329
Reputation: 2,012

Post » Thu Jun 26, 2014 12:12 am

brunopalermo wrote:
SquareMation wrote:If you want your turret to be able to turn independent of the base, you must pin it position only.


Pretty sure this does not work, i have tried.
BUT i will try to make small project with just this when i get home to rule out something else in project is not affecting it.
B
8
S
2
G
2
Posts: 34
Reputation: 1,707

Post » Thu Jun 26, 2014 1:18 am

brunopalermo you seem to be right. I can only assume this has to do with using families *sigh*

families and functions killin' me :evil:
B
8
S
2
G
2
Posts: 34
Reputation: 1,707

Post » Thu Jun 26, 2014 11:57 am

If I had more detail on what exactly you're trying to achieve I may help finding a work around. :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
15
S
3
G
1
Posts: 329
Reputation: 2,012

Post » Sat Jun 28, 2014 12:42 am

brunopalermo wrote:If I had more detail on what exactly you're trying to achieve I may help finding a work around. :)


NW, I got this resolved, I simply started project over. It works exactly as you described :? . It works fine now, i think some how a function was bugging it. I was trying to create a function to set Hit Points for different members in a family, and for some reason it went hay wire throughout program, lol :shock:
B
8
S
2
G
2
Posts: 34
Reputation: 1,707

Post » Sat Jun 28, 2014 9:52 am

you mean like this
You do not have the required permissions to view the files attached to this post.
B
245
S
39
G
15
Posts: 1,946
Reputation: 40,276


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Allardje, R0J0hound, Rudi55, sublimate, Vinterstille and 1 guest