Issue with actor spawning

In my scene i have an actor spawn another actor. the new actor instantly has its velocity changed to move to the left. if the new actor hits anything it gets destroyed and the game goes back to level select. when you start the scene again every so often the spawned actor will go up or down instead of going left. how can i fix this?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Are you using the Move behavior? It's kind of been...broken for a long time. Try changing the actors self.Motion.Linear.Velocity X to -400
  • polimerjonespolimerjones Member Posts: 50
    i am actually using change velocity
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Can you post your project/pics of your rules?
  • polimerjonespolimerjones Member Posts: 50
    they are as i said

    actor1

    after 0 sec spawn actor2



    actor2

    after 4 sec change velocity to 0 (heading right) at 25 (speed)

    if actor2 collides with any actor3
    then go to level select

  • polimerjonespolimerjones Member Posts: 50
    ive also tried using your idea of changing attribute x which works the first go but the next time it loads the actor2 will head down
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    That shouldn't be happening..Can you send me your project file?
  • polimerjonespolimerjones Member Posts: 50
    thanks for your assistance. i got really frustrated and made it so when i choose the level it resets every attribute back to default. this should not have fixed the issue because none of the attributes are linked to actor2 movement..... but it did, as far as i can tell at least.


    i do have one more question if you have the time.

    the same actor two i have setup to check direction of movement every 2 seconds. (the two seconds is based on the fact that the game squares are 50 pixels and the actor speed is 25)

    if during game play the speed is adjusted how could i adjust the time in which to check.

    i have tried constraining self x + y to "speed" and telling actor2 to check every 50/"speed" but for some reason that doesnt work. got any other suggestions.

    thanks in advance. if its to much trouble is appreciate the assistance already given.
  • polimerjonespolimerjones Member Posts: 50
    edited May 2013
    by the way movement is limited to up down left right. no diagonal that is why x+y should work
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Not sure I totally understand your second question....
  • polimerjonespolimerjones Member Posts: 50
    i basically have squares like a chess board that are 50 pixels. actor2 will move left at 25 pixels a second. setting up the check for direction at 2 seconds ensures that actor 2 will clear a whole square before checking direction again.

    the problem with this is that if i change actor2's speed to lets say 50 then it would only need 1 second before it checked again.

    as ive said i have tried 50/(x+y) which should be 2 if moving x=25 and 1 if x=50 but it doesnt.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Instead of trying to time when the actor reaches a certain x value, just have a rule that checks to see if it is on edge of a square (or middle or wherever you are wanting to check).

    If your squares are 50 pixels and also touching (i.e. 50 pixels apart from each other), you would do

    When game.ZERO=mod(self.position.X,50) --> [behaviors]

    This will work as long as your actor isn't moving at a very high speed because then it will skip over pixels while it moves.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.