Curve line with a ball

michelericciomichelericcio Member Posts: 45
edited November -1 in Working with GS (Mac)
Hi I have a problem, I wanted to make a ball from a bottom right corner (and random on the Y axis) to be launched every shot will vary by strength, speed and height ... how do I achieve this?
can the ball accomplish a curve line?

Comments

  • ValanValan Member, BASIC Posts: 410
    Give the ball a target actor to hit.

    Moving the target and updating the balls trajectory will induce a curved path.
  • michelericciomichelericcio Member Posts: 45
    sorry, it's a possible have a example?
  • michelericciomichelericcio Member Posts: 45
    nothing? :S
  • ValanValan Member, BASIC Posts: 410
    create 2 game attributes: Target.X and Target.Y

    create an actor called Target. This is spawned at the same time as your shots but over on the other side of the screen. Give it an initial Move behaviour.

    In Target Constrain Game.Target.X to Self.Position.X and do the same for Target.Position.Y

    In your shot actor Accelerate Toward or Move To Game.Target.X and Game.Target.Y.

    The shot actor moves towards the Target actor and changes flight path as Target also changes position.
  • michelericciomichelericcio Member Posts: 45
    Hi thanks for the "lesson" ;)
    this is a example for all!
    http://gamesalad.com/game/play/52472

    Now, i have another question, can i "randomize"(velocity, path ecc) more balls for X time?
    how I can make?

    sorry for my bad english :S

    thanks!
  • RHRH Member Posts: 1,079
    yes, use the random function
  • michelericciomichelericcio Member Posts: 45
    how?? :P
  • michelericciomichelericcio Member Posts: 45
    up! tshirt? codemonkey? valan? rorryror? XD
  • quantumsheepquantumsheep Member Posts: 8,188
    You action the random function by pressing the 'e' symbol in various behaviours where you can put in a value.

    A box comes up with two drop down menus.

    In the second drop down box, you'll find various functions.

    One of these is rand(1,2)

    replace the 1 with the lowest value. Replace the 2 with the highest value. This gives you the range of numbers that random will select a value from.

    And that's pretty much it. One of the simplest and widely used functions.

    Hope that helps!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.