How to do teleporting actor with these specific actions?

TonyuTonyu Member Posts: 21
edited October 2014 in Working with GS (Mac)

Hi new guy here. I want to make an annoying alien enemy in my game that, once in a while, teleports to a random spot in the field and fires its beam gun at the player. I know how to make an actor teleport into a random location by setting its self.position to a random location ever x seconds with a custom timer. I also know how to make an actor shoot by spawning a bullet actor. Now thing is, I'm stumped on how to make him behave like this:

  1. spawns with "beam in" animation (like star-trek)
  2. after Xsec - charge gun animation
  3. after Xsec - fire gun animation
  4. after Xsec - reload gun animation
  5. after Xsec - beam out animation
  6. teleport to random location then repeat #1

*optional - Xsec delay between #5 and #6. Meaning the alien is out of the field for a while before "beaming" back in.

Help please? Thanks in advance!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    1. spawns with "beam in" animation (like star-trek)

    Make a beam-in animation, apply it to an actor - spawn that actor on the scene and then have that actor spawn the enemy once it's completed its animated beam-in sequence.

    1. after Xsec - charge gun animation

    'Charge gun' doesn't really mean anything, or it could mean absolutely anything, do you mean that a value called 'gun' is changed or the amount of shots available is increased or the ability to shoot is switched on, or an animation of a gun that was otherwise static starts to to glow, or a meter on the top of the screen that shows 'gun charge' fills up . . . or a hundred other things . . . ?

    You really need to be a lot more specific, it'll help people throw some ideas your way.

    1. after Xsec - fire gun animation

    Similar question to the one above, can you be more specific, do you want your character to fire a projectile, or do you want to play an animation of a gun firing, or maybe something else . . . ?

    Do you have a gun at the moment, and does it fire ?

    1. after Xsec - reload gun animation

    Same as above.

    1. after Xsec - beam out animation

    Just replaying your beam-in animation backwards might do the trick.

    1. teleport to random location then repeat #1

    That would simply be a change attribute behaviour, when all the above is finished: change attribute x position to random (A,B), change attribute y position to random (A,B).

    *optional - Xsec delay between #5 and #6. Meaning the alien is out of the field for a while before "beaming" back in.

    Just stick the initial spawning behaviour into a timer with a random delay.

  • TonyuTonyu Member Posts: 21

    @Socks Hi and thanks for the reply. Sorry if I wasn't specific, allow me to try and explain better.

    As far as animations are concerned, I already have those ready. I already have the beam-in animation, the charge/reload gun animation, etc. What I'm trying to do is making the alien and those animations play in order and with delays. At the moment the alien actor has these rules:

    every 5 seconds
    do change attribute self.positionX to random(0, 480)
    do change attribute self.positionY to random(0, 320)
    spawn actor bullet

    However with these rules, the alien shoots the bullet **immediately **after appearing in a new location. What I want it to do is after appearing in a new location, there will be a delay before he shoots so that I have enough time to show the beam-in and charge gun animations. I tried a timer before the spawn actor bullet but the actor's timing gets messed up.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Tonyu said:
    . . . . with these rules, the alien shoots the bullet **immediately **after appearing in a new location. What I want it to do is after appearing in a new location, there will be a delay before he shoots so that I have enough time to show the beam-in and charge gun animations . . .

    Could you not simply place the beam-in and charge gun animation sequences in the same animation behaviour ? Literally drag the two sequences into the same animation behaviour.

    Or you could use the final frame of each animation sequence as the trigger for the next animation.

    Imagine we have two sequences BeamIn001 - BeamIn002 - BeamIn003 - BeamIn004 - BeamIn005 . . . . and . . . . . ChargeGun001 - ChargeGun002 - ChargeGun003 - ChargeGun004 -ChargeGun0014.

    The logic should look something like this . . . .

    Animate behaviour / BeamIn image sequence.

    Rule: When self.image = "BeamIn005"

    - Animate behaviour / ChargeGun image sequence

  • TonyuTonyu Member Posts: 21

    @Socks said:

    - Animate behaviour / ChargeGun image sequence

    Thanks again Socks. I finally got it to work based on your suggestion and a few more tweaks! :)

Sign In or Register to comment.