how to pin an actor on top of another actor
In my game i have a tank and a separate actor for the gun when the tank moves it leaves the gun in its spot. How do i keep the gun attached to the tank?
Jarritos
In my game i have a tank and a separate actor for the gun when the tank moves it leaves the gun in its spot. How do i keep the gun attached to the tank?
Jarritos
Comments
Make game attributes for the X and Y positions of the tank (and rotation if you want the gun to move with it).
In the tank actor, constrain these X and Y game attributes to self.position.x and self.position.y.
Then on the gun actor, constrain self.position.x and self.position.y to the X and Y game attributes.
Do the same for rotation if you want that constrained too.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
That just made the gun disappear.
Jarritos
i fix the disappear thing but it still doesn't work
Jarritos
In what way doesn't it work?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Jarritos In future, please don't make duplicate threads in different Forums - it's against the rules, and can cause confusion.
(I've deleted your duplicate thread).
BUMP:
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
when i do what u told me my gun disappears
Jarritos
thx gyro
Since I'm not really sure what you're trying to accomplish, or why what I suggested didn't work, take a look at the example below. It is a tank with very basic movement and a gun attached that moves with it but swivels independently (towards the cursor).
Note that in order to keep the gun centrally located on the tank, rather than use any fancy maths I just made the gun empty space bigger. This means the gun itself could not be used to detect collision, only the tank. Fancy maths could do the same job if that's important to you.
Refresh the page if the attachment doesn't show up.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
when i try that it only does it one time then stops i have constrained attributes
Jarritos
Please post screenshots of the rules you are using.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
jorritos go to layers and make another layer and uncheck scrollable and drag the gun actor to the non-scrollable layer. if your tank does not controll the camera, this will not work.
ok here they are
Jarritos
sorry freeze this did not work for me, but thanks for your help anyway
Jarritos
There is no need to place the two constrain behaviours within the 'every 0 seconds' timer.
ok socks thx
Jarritos
Jarritos
at the very begining it is doing this

All of your images are showing as broken for me.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
thats weird socks could see them maybe this will work

Can you see the images you have put in your posts ?
no socks and don't know why
Jarritos
It's pretty safe to say that if you can't see the images in your posts then no one can. I expect your image links aren't properly formatted.
ok. I don't know how to post screenshots if that didn't work.
Jarritos