Turret Attributes?

FlightfreakAppsFlightfreakApps Member Posts: 20
edited November -1 in Working with GS (Mac)
Hey everyone, I need some advanced help.
I'm making a missile defense game (here's a screenshot)

http://i51.tinypic.com/10rpz12.jpg

The missiles will come in from the top of the screen, and the player's job, of course, is to protect the city from destruction. What I need help with is how the player will shoot down impending doom. I want a bullet to originate from the bottom of the screen and head for where the player taps. Any help? Thanks!

Comments

  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    phew... you're asking quite alot in one question.
    Have you looked at all the videos in the CookBook and on youtube. All your answers are there.

    But here goes nothing

    Firstly: Make a Turret actor. Place it where you want it to shoot from.
    Then open the actor and create a new rule:

    If touch is pressed
    Constrain Attribute: vectorToAngle(game.Mouse.Position.X-self.Position.X , game.Mouse.Position.Y-self.Position.Y)

    Spawn Attribute
    Actor: (your bullet) in back of layer

    Open up you bullet actor:
    Put in a move behavior
    Direction 0 relative to actor
    Speed = (what ever you want)

    Killing your enemy:

    Create a new rule on your bullet:
    If actor overlaps or collides with enemy
    Destroy

    Create new rule on enemy:
    If actor overlaps or collides with bullet
    destroy

    Create a new integer game attribute called score
    Make an Actor called score
    Set opacity to 0 and put a text behavior and give it a bright color.
    where it says hallo world, theres a small e where you select your game.score attribute.

    put the actor in your scene.

    Go back to your enemy:
    In the other rule you made, put in a change attribute behavior
    Change attribute game.score to game.score+(how many points you want for killing and enemy)

    There... i made the game for ;)
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    You might even wanna make all of your building separate and give then each of them a life attributes.
    If you have 3 images of each building. you can make it the buildings crumble each time it gets hit but your enemy missiles.
  • FlightfreakAppsFlightfreakApps Member Posts: 20
    How exactly do I do the first constrain attribute behavior? I am confused as to how I would enter two mouse coordinates and a VectorToAngle in one Constrain Attribute behavior. Is it possible that you could link me to a video or a screenshot on how to enter these attributes?

    Thanks.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Hey There,

    You use the expression editor to get it all in the same expression. But it seems to me like your getting ahead of yourself. You should check out all the videos on the gamesalad cookbook youtube channel and on gshelper.com
  • FlightfreakAppsFlightfreakApps Member Posts: 20
    Okay, I got part of it. If I use this Constrain Attribute Behavior (the second box (To:) says: vectortoangle(game.mouseposition.x , game.mouseposition.y).

    http://i51.tinypic.com/s6hb1z.jpg

    So what should be in the first box (Constrain Attribute:)?

    Sorry for the noobish Questions. Thanks for all your help!
Sign In or Register to comment.