Parenting

For questions about using Classic.

Post » Fri Dec 07, 2007 4:11 pm

I`ve just got the programme and i wanted to know how i can Parent my gun to my player atm its just a gun that moves with mouse and shoots but i can`t make it follow player.
B
2
G
5
Posts: 13
Reputation: 1,276

Post » Fri Dec 07, 2007 5:33 pm

I wonder this too.
In my current project I have a variable that is checked, and if it is 1, I move the weapon on top of the player every frame.
It works, but a Sword.Parent( Player ) would be a nice thing to have. :)
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Fri Dec 07, 2007 8:34 pm

Apparently that's what the Containers are for. I haven't messed with them at all, but you're supposed to be able to put your gun into your player's Container and it will move with it.

I'll fiddle around with it some and see how it works.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 08, 2007 5:09 pm

You don't necessarily need containers to get this to work (containers are generally only useful if you have multiple object instances).

The best way is to use image points. If you don't know how image points work, the Ghost Shooter tutorial explains them. Basically if you place an image point where you want your object to be positioned on your player, then you can use the event 'Always' - Gun: 'Set position to another object'. You can position it by the player, image point 1, and it goes to where you placed the image point in the picture editor.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests