Would love some help with an Archery (bow & arrow) prototype

Hi guys,
I've spent a few hours going over scenarios with constraining actors to each other, trying to get my head around RThurman's thread http://gamesalad.com/forums/topic.php?id=29037&page=3 and came to the conclusion I'll need some help figuring this out. I can't seem to get things working the way I want.
</img>
Above is an example image of what I'm trying to achieve.
- first the main pivot for everything would be rooted at the character chest area as shown by the red dot
- the bow will need to be constrained to this as well (position/rotation)
- I'm trying not to have empty space in the actors to simulate a make shift pivot point which is why I read RThurman's thread
- finally the arrow will be constrained to one axis (this being X) to simulate a 'drawing' action when the user pulls back on the arrow
To further illustrate what I mean, watch an example of it in action
Really would appreciate any help on figuring this out as 50% of the game is based around this design.
thx,
~t
I've spent a few hours going over scenarios with constraining actors to each other, trying to get my head around RThurman's thread http://gamesalad.com/forums/topic.php?id=29037&page=3 and came to the conclusion I'll need some help figuring this out. I can't seem to get things working the way I want.

Above is an example image of what I'm trying to achieve.
- first the main pivot for everything would be rooted at the character chest area as shown by the red dot
- the bow will need to be constrained to this as well (position/rotation)
- I'm trying not to have empty space in the actors to simulate a make shift pivot point which is why I read RThurman's thread
- finally the arrow will be constrained to one axis (this being X) to simulate a 'drawing' action when the user pulls back on the arrow
To further illustrate what I mean, watch an example of it in action

Really would appreciate any help on figuring this out as 50% of the game is based around this design.
thx,
~t
Comments
So bare bones here's what I have/done so far.
- Have a bow on screen against a background actor
- in the bow rules page I have a simple Rotate to Angle rule
vectorToAngle(game.Touches.Touch 1.X - self.Position.X , game.Touches.Touch 1.Y - self.Position.Y)
that works as expected when I touch the screen
- for the arrow I have a "Change Velocity" rule
- now in order to shoot an arrow while while I have the above Rotate to Angle rule applied I decided to assign the Spawn Actor rule to the BG actor so when this actor receives the event "touch is released" it spawns the Arrow actor.
Great that works now to spawn the arrow actor position to that of the bow
- I created two scene attributes for X/Y respectively
in the spawn actor rule I set the expressions to game.X/Y respectively
in the bow rule I created to Constrain Attr. - game.playerX to self.Position.X and likewise for Y
That worked!
Now I would like the arrow to rotate in the direction of the bow and travel along that direction... this is where it got tricky and broke down for me.
still going... And yes I'm probably going about this wrong, so chalk that up to learning.
thx!
- now in my bow rule screen I applied another constraint to --- game.pivotActorAngle to self.Rotation so it can find the bow's rotations
- then in the arrow rule screen I created another constraint rule --- self.Rotation to game.pivotActorAngle + 90 --- (the 90 was for the starting rotation because of the graphic)
Low and behold that works. Now I guess the next step is tshirtbooth's vid on power meters.
On the right track?
I'll keep going, learning is fun mmmkay.
~t
You're game is looking really nice, by the way. I expected something different than that with your name and avatar image! :-)
----------------------------------------------
http://davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I'd suggest that you make both the bow and the arrow image face to the right so that both self.rotation and the image line up. That way you don't have to add "+90" here and there.
RThurman thanks for chiming in! I will do just that actually, so it doesn't compound on itself later
Cheers!
~t
Gameplay looks promising too.
Cheers,
Ludwig
Lump Apps and My Assets
Lump Apps and My Assets