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

lildragnlildragn Member Posts: 105
edited November -1 in Working with GS (Mac)
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.

image</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

Comments

  • lildragnlildragn Member Posts: 105
    Ok so I'm going to break this right down and post what I did in hopes I get a reply...

    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!
  • lildragnlildragn Member Posts: 105
    Ok got something here... created another scene attr. and gave it the name "pivotActorAngle"

    - 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
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Good stuff, lildragn; glad you got it sorted. Well on the track, as far as I can see.

    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

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    lildragn said:
    On the right track?

    I'll keep going, learning is fun mmmkay.

    It seems that you have the handle on it just fine!

    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.
  • lildragnlildragn Member Posts: 105
    haha most do I guess :) But have to correct you on the game, it's not mine, but what I'm hoping to achieve. It's my main source of inspiration right now.

    RThurman thanks for chiming in! I will do just that actually, so it doesn't compound on itself later

    Cheers!

    ~t
  • LumpAppsLumpApps Member Posts: 2,881
    May I complement you on your awesome graphics.
    Gameplay looks promising too.

    Cheers,
    Ludwig
  • lildragnlildragn Member Posts: 105
    Sorry must make it clear... The images/video I posted are not mine. Hit the apple was made by Falcon Mobile http://falconmobile.com/games.html and serves only as inspiration. :)
  • LumpAppsLumpApps Member Posts: 2,881
    Ah, then they suck ;)
Sign In or Register to comment.