Gravity on an actor

DillonVDillonV South FloridaMember Posts: 26
Hey everyone, Game salad newbie here. I just recently joined the forums and I'm new to the Gamesalad program. I found a few tutorials on Youtube on how to create gravity on an actor. However, I can't seem to find any tutorials on what I'm trying to do. In my game, I have a spawning actor at the bottom of my screen. Every second or so, the actor spawns 3 random enemies in different directions upward. I'm trying to have those enemies shoot up at a certain height, then have gravity take them down. Right now the enemies just shoot up straight in the air and out of the scene. Sorry if this issue has been posted before, newb here lol

Thanks for the help!

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited December 2013
    You can either add Gravity to your entire Scene, in the Scene Tab. Or you can use an Accelerate Behavior on each actor. I prefer the second method because it gives you more control.

    So in your case, whatever actor(s) you are spawning that shoot up in the air, add an Accelerate Behavior to them. Use a Direction of 270 to bring them back down and adjust the Acceleration as needed to get the effect you want.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    On the enemy actors:

    Accelerate [direction & speed: whatever you have them set to]
    Timer after 1 second
         Accelerate [direction: 270] [speed: number greater than acceleration speed above] [relative to: scene]

    You'll have to play around with the timer duration and the speed to get it right.
  • DillonVDillonV South FloridaMember Posts: 26
    Thank you both very much. I knew it had to be something easy I was missing.
  • DillonVDillonV South FloridaMember Posts: 26
    Can you also use the Random(min,max) function to shoot those enemies in different areas of the screen? The way I have it set up is kind of predictable (the enemies shoot straight up only). I want them to shoot up in different directions but can't seem to get it working. Thanks.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Oh, I thought you already had that. Yes, of course. Accelerate [direction: random(70,100)] or whatever values you prefer. Set the relative drop-down menu to Scene. You can spawn them in a random direction and just have them go straight, but I prefer to spawn them at a specific direction (e.g. 0, it doesn't really matter) and then use the random function in the accelerate behavior in the enemy actor, as I just described.
  • DillonVDillonV South FloridaMember Posts: 26
    Oh, I thought you already had that. Yes, of course. Accelerate [direction: random(70,100)] or whatever values you prefer. Set the relative drop-down menu to Scene. You can spawn them in a random direction and just have them go straight, but I prefer to spawn them at a specific direction (e.g. 0, it doesn't really matter) and then use the random function in the accelerate behavior in the enemy actor, as I just described.
    Okay thanks again for the help! Everything is working perfectly now.
Sign In or Register to comment.