Need help with soccer/hockey style game.

arkonllfarkonllf Member Posts: 118
edited July 2012 in Working with GS (Mac)
i am working on a soccer/hockey style game, and i am having a few problems.
1. how can i stop the blue disk from passing the barriers? and the white disk bouncing from it?
Image and video hosting by TinyPic
2.how can i make the white disk shot when it hits the blue disk?(just as it would in air hockey)
3.is it possible to make a computer actor/player? if so how hard it is to do that in gamesalad?

Comments

  • WTDeveloperWTDeveloper Member Posts: 352
    Hey arkonllf,
    1. create a new actor and call it "wall", in the white disk and the blue actor put in the collide behavior and let it collide with the wall actor. Set the bounciness of the white actor to 1 and the bounciness of the blue disk to 0.

    Hope it helps you ;D
    WTDeveloper
  • master200012master200012 Member Posts: 372
    edited July 2012
    2. Use the change velocity behavior if you want the ball to travel like being kicked. You'll need to create a game attribute (angle) and constrain it to the guy's rotation. This will allow the ball to fly in the same direction the guy kicks it.

    Also, if you want the speed of the ball to vary based on the speed of the guy, create another 2 attributes (real). One named "vel x" and one "vel y". Create a rule in the guy:

    When actor overlaps or colides with ball,

    Change "vel x" to self.motion.linear velocity x
    Change "vel y" to self.motion.linear velocity y
    --------------------------------------

    In the ball, put

    When actor overlaps or collides with guy,

    change self.linear velocity x to "vel x"
    change self.linear velocity y to "vel y"
    --------------------------------------

    If you want the ball to fly farther when the guy kicks it, modify the change attributes in the above rule to something like: change self.linear velocity x to (2*vel x).

    Good Luck!

    P.S. might wanna watermark that image...
  • arkonllfarkonllf Member Posts: 118
    Hey arkonllf,
    1. create a new actor and call it "wall", in the white disk and the blue actor put in the collide behavior and let it collide with the wall actor. Set the bounciness of the white actor to 1 and the bounciness of the blue disk to 0.

    Hope it helps you ;D
    WTDeveloper
    for some reason it didn't work for me-
    i made the wall actor and put it on the side, this is its physics:
    -density 1
    -friction 3
    -bounciness 0
    -fixed rotation on
    -moveable off

    then i put a collide attribute in the blue actor, the blue actor's physics are:
    -density 1
    -friction 3
    -bounciness 0
    -fixed rotation on
    -moveable on

    and a collide attribute in the white disk, the white disk's physics are:
    -density 1
    -friction 3
    -bounciness 1
    -fixed rotation on
    -moveable off

    may the physics be the problem here?
    2. Use the change velocity behavior if you want the ball to travel like being kicked. You'll need to create a game attribute (angle) and constrain it to the guy's rotation. This will allow the ball to fly in the same direction the guy kicks it.

    Also, if you want the speed of the ball to vary based on the speed of the guy, create another 2 attributes (real). One named "vel x" and one "vel y". Create a rule in the guy:

    When actor overlaps or colides with ball,

    Change "vel x" to self.motion.linear velocity x
    Change "vel y" to self.motion.linear velocity y
    --------------------------------------

    In the ball, put

    When actor overlaps or collides with guy,

    change self.linear velocity x to "vel x"
    change self.linear velocity y to "vel y"
    --------------------------------------

    If you want the ball to fly farther when the guy kicks it, modify the change attributes in the above rule to something like: change self.linear velocity x to (2*vel x).

    Good Luck!

    P.S. might wanna watermark that image...
    for some reason this didn't work for me either (i assume i am doing something wrong).
    in the guy actor i put a constrain attribute: constrain game. player angle(the angle attribute) to self.rotation.
    and in the white disk actor i put a rule actor- when actor overlaps or collaides with the guy,
    and in it a change velocity attribute that says: direction- player angle(the angle attribute).
  • master200012master200012 Member Posts: 372
    Gonna need more info than that. For example, what exactly does happen?
  • arkonllfarkonllf Member Posts: 118
    edited July 2012
    Gonna need more info than that. For example, what exactly does happen?
    well nothing really- no matter from wht side i hit it, it goes right.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    How are you controlling the blue disk? I imagine you can move it around correct?
  • arkonllfarkonllf Member Posts: 118
    How are you controlling the blue disk? I imagine you can move it around correct?
    once the mouse is pressed on it it follows the mouse.
  • arkonllfarkonllf Member Posts: 118
    Bump
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yes when you use constrain to mouse it overrides the collision. There are a couple video of how to work around this issue. Look them up.
  • arkonllfarkonllf Member Posts: 118
    Yes when you use constrain to mouse it overrides the collision. There are a couple video of how to work around this issue. Look them up.
    thanks for help!
    i just changed the moving method to joystick type movement and it works great now.
    but i am still having problems trying to do what @master200012 told me.
    no matter from what side i hit it, it always shots right.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I'm not sure how you want to control the ball to shoot at the goal. You might want to look at tshirts video site there are some options for aiming objects and firing them.
  • master200012master200012 Member Posts: 372
    edited July 2012
    Just a guess but, are you constraining the rotation of the guy to the direction it's following? If not, then make sure you know how.

Sign In or Register to comment.