Having an actor bounce around the screen in any direction?

Macca_McGillMacca_McGill Member, PRO Posts: 108
edited November -1 in Working with GS (Mac)
Hi guys,

I have a game where i need an actor to spawn just off screen, if thats possible? I then want it to bounce around the screen in any x,y direction until the user touches it. Does anyone have any ideas how i can create this?

Thanks in advance.

Comments

  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    anybody have any ideas? i tried using move to random but it just doesnt move once spawned.
  • KrakenCMTKrakenCMT Member Posts: 22
    I'll attempt to answer this, though my knowledge of GS is in the beginning stages as well. But I imagine you would just place the actor off screen then give it a push in a starting direction with the accelerate attribute with a direction which sends it onto the main playing area. After it's moved onscreen, you could have it spawn the immovable walls. Then just set up the actor to collide with the walls. The Restitution setting in the actor's attributes section controls how bouncy it is.
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    Here what i would do.
    You are on the right path. but you need to trigger your move behavior

    Depending on where you place your actor.

    Create new rule on the bouncing actor.
    Timer: After (what ever you want)

    Accelerate (or move) direction.random(110,260) i placed on the left side

    Create new rule
    If actor touch is pressed

    Change attribute self.motion.X = 0
    Change attribute self.motion.Y = 0
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    would i need to create the walls to enable to actor to bounce around as kraken mentions? Ive got my game running landscape so the resolution is 480, 320. So would i have it as direction.random(320,480)??

    Thanks
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    Hi guys, i managed to get the actor bouncing around fine. But evertime it hits one of the walls, the actors speed increases drastically? I want the actor to move around at a set speed, everytime the actor is shot, the new actor spawns and moves a little faster than before. Does anyone have any ideas? Do i need to create an attribute called target_speed then relate its movement speed to that?
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    yeah but that will only set the max speed the actor will move overall wont it. I want to have it starting off at say 150 speed, then everytime the actor is shot, the next spawning actor will move at +10 speed(so 160) and so on. The problem im having at the minute is that when the actor spawns, ive set it to move onto the screen at random x,y. But when it starts bouncing off the walls, it increases speed everytime it bounces. I want it to move at a concistent rate, until its destroyed.
  • Macca_McGillMacca_McGill Member, PRO Posts: 108
    I worked out wat id done :) i changed the friction to 0 by mistake haha. Dont suppose anyone knows, when using the changd velocity, which direction is 0? I need to work out which angles to set the bouncinv too.
    Cheers
Sign In or Register to comment.