Constrain a missile head actor to a missile body actor
Hi guys
I would like to know the easiest way to make sure one actor appears in front of another actor as the head of the missile is going to cycle through colours and I don't want the missile body to do the same - so I have created two actors (Missile Body 64 x 64) & (Missile Head 64 x 32).
The missile actor moves up and down the left hand side of the screen and i need the missile head to stick on the front of it.
I must also note that the missile is fired across the screen (left to right) when it is touched by the player.
The two actors are called:
Missile body (Size 64x64)
Missile Head (Size 32x64)
Whats the easiest way of getting the done?
Thanks in advance
I would like to know the easiest way to make sure one actor appears in front of another actor as the head of the missile is going to cycle through colours and I don't want the missile body to do the same - so I have created two actors (Missile Body 64 x 64) & (Missile Head 64 x 32).
The missile actor moves up and down the left hand side of the screen and i need the missile head to stick on the front of it.
I must also note that the missile is fired across the screen (left to right) when it is touched by the player.
The two actors are called:
Missile body (Size 64x64)
Missile Head (Size 32x64)
Whats the easiest way of getting the done?
Thanks in advance
It takes a Zombie to know a Zombie!!!
Comments
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
missileBodyX
missileBodyY
In the missile actor add 2 behaviors
constrain game.missileBodyX to self.x
constrain game.missileBodyY to self.y
In the missileHead actor add 2 behaviors
constrain self.x to game.missileBodyX
constrain self.y to game.missileBodyY
make sure you have a copy of the missileHead on the screen unless you plan on spawning it
When you test it, you will notice the missileHead will be in the center of the MissileBody, so go back to the MissileHead and offset the position some. Maybe something like this:
constrain self.x to game.missileBodyX+32
constrain self.y to game.missileBodyY+32
adjusting the amount will offset the head from the center of the missileBody. You will have to mess around with the values to get it right.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I had seen the video TS did but I was just asking if there was an easier way to stick to graphic actors together.
I will try the code (Thanks Fzeed) as its so much easier working from a printout than keep watching/pausing a video
Thanks guys
It takes a Zombie to know a Zombie!!!
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS