Wake Up An Animated Object?

Discussion in 'How Can I...?' started by Phill Mason, Oct 8, 2015.

  1. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Hi there fellow Boxers, I've just animated an enemy and it's a robotic arm that animates from above, slamming down to crush my character. I have two issues you might be able to help me with.

    1: When I create the collision point of the animation (ie the metal plate that crushes the character), the collision hit area stays in the same place and does not follow the animation, therefore it doesn't kill my character. Is there any other way to get the collision shape to follow an animation?

    2: Can I wake up an animated object? I'd like to be able to have a machine dormant until I get really close to it and then come to life and cycle through it's animation. Is this doable? Cheers.
     
  2. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    Not really, perhaps there is a work around using separate, connected objects... but this is a basic game dev principle (not changing the collision shape of a single animation) that is tough to change even if not using Buildbox.

    Animation plays by default it seems before wake up. Not sure if there is a work around for this or not.
     
    Phill Mason likes this.
  3. stevinz

    stevinz Avid Boxer

    Joined:
    Sep 25, 2015
    Messages:
    169
    Likes Received:
    142
    @Phill Mason As far as #2 goes I have a method I use that may or may not work for you in your situation.

    Create an invisible action and put it on the screen where you want your character to be when the machine wakes up. Its not actually going to do anything. Set it to action type "None", duration really small like ".001", animation behaviors "Powerup", "Overlay", "Single". Have the unanimated machine on the screen. Link the machine FROM the action.

    When your character collects the invisible action, the machine will disappear. In the action animation for the invisible gameplay action you created, have it spawn a new animated machine object exactly where the old one was (may take a little playing around to get it to line up right). Set the spawning on the new object super high like "100000" so you only end up with one of them. If it ends up being too difficult to line up perfectly you could have the action also do a short "camera flash" to hide the transition.
     
    neuronz, Phill Mason and Christoph like this.
  4. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Thanks @Andy, seems the collision shape of an animation is trickier than I thought, thanks for pointing it out.
    I'm having a play around with a couple of possible hacks for the animation wakeup idea.
     
  5. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Nice one @stevinz, love you way of thinking man :) I was playing around with transparent object getting rid of a static image, but even at lightning speed, you can still see it leave the screen, so your transparent-action idea is better, thanks bud.

    I'm still fudging around with it, but I think I'll that I need two actions, 1 to get rid of the static image and 2 to create the machine animation, as I don't think I can create a spawner within an action animation box - do you know of a way?

    I reckon if I stack the actions almost on top of each other, the 1st one will disappear within 0.001 sec and then the 2nd one will trigger the machine animation and stay on screen as a looped animation.

    I'll report back with some kind of visual if it all pans out. Thanks for chiming in, much appreciated.
    As a side note, where in the world are you based?
     
  6. stevinz

    stevinz Avid Boxer

    Joined:
    Sep 25, 2015
    Messages:
    169
    Likes Received:
    142
    You only need one, I've done it many times.

    The "default animation" for the action will just be nothing, or a transparent image. The "action animation" for the action is where you will spawn your new machine (or any other object). So this action will both destroy your static machine and spawn a new animated machine. You will have to have the static machine be a separate non-animated object. So you will have two objects, one animated, one non-animated. Ideally the actual image size, including blank space, will be the same for both the animated and non-animated versions so that they will line up perfectly within build box during gameplay.

    Open the "action animation" window for the object, drag an object from the left side of the windows under "Objects". Select the object in the animation window and check the "Spawner" box. Set the "Spawn Rate" very high, like "100000". This will ensure you only spawn one new animated machine. Set the "spawn type" to "permanent". You can also select collide / non-collide, destroy enemy, etc. I usually don't use the drop down at the top for any objects (physics, enemy, bullet, etc) as they don't actually do anything besides change the values below. Place this object within the animation window such that it will spawn where your old non-animated machine was. So if for example, you have placed this invisible action 500 pixels to the left of the non-animated machine, the new animated machine should be 500 pixels to the right of 0 within the animation editor. You will have to ensure the action's "animation placement" is set to "powerup", this will mean the new object will spawn exactly on top of where the action was on the screen. And since you placed the animated machine 500 pixels to the right, the new animated machine will spawn 500 pixels to the right of where the action was.

    This is ridiculously hard to explain, but really pretty simple. ;-)

    ....And I'm in Virginia Beach, VA. You?
     
    rob_mabry, darone and Phill Mason like this.
  7. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Going through it now @stevinz, thanks. I really appreciate how difficult it is to explain via text and I'm grateful you're really trying to spell it out for me, cheers man :) I'm in Cambs, UK.
     
  8. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    @stevinz, nailed it bud :) I didn't have the machine animation as an object, I'd dropped it directly onto my transparent action animation box, which is what I was doing wrong.

    It works a treat now and looks great. I'm now going to add a repeating hammer sound to it via another transparent trigger image that is in time with the machine animation and then I'll upload a short video clip to show the results, thanks again for your BB Hack.
     
  9. stevinz

    stevinz Avid Boxer

    Joined:
    Sep 25, 2015
    Messages:
    169
    Likes Received:
    142
    tomwhite3d likes this.
  10. tomwhite3d

    tomwhite3d Boxer

    Joined:
    Sep 28, 2015
    Messages:
    97
    Likes Received:
    39
    Thanks Stevinz it was a great help!
     
  11. mobile_gamegraphics

    mobile_gamegraphics Boxer

    Joined:
    Oct 12, 2015
    Messages:
    86
    Likes Received:
    29
    @Phill Mason Are you able to do a quick video or screenshots? Am curious how you actually did that :)
     
  12. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Yup, will do @mobile_gamegraphics, I'll try and do a quick screen video to give you an idea of the results.
     
    mobile_gamegraphics likes this.
  13. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Hi @mobile_gamegraphics, here's a quick screen video of what the result of this post was all about. I didn't go into great detail in the video as it's all here in this thread, but you can see from the video that I wanted to approach my robot crushing machine with it being static and when you get close enough, it wakes up and tries to kill you - nice :) Let me know if you have any questions.
    Mr Buzz - Wake Up Animation Demo.

    ** Special shout-out to @stevinz, for his fab assistance against the resistance - the force is strong my friend :)
     
    Last edited: Oct 14, 2015
  14. stevinz

    stevinz Avid Boxer

    Joined:
    Sep 25, 2015
    Messages:
    169
    Likes Received:
    142
    @Phill Mason Glad to be able to help. The game looks fantastic!! Can't wait to play it!
     
    Phill Mason likes this.
  15. mobile_gamegraphics

    mobile_gamegraphics Boxer

    Joined:
    Oct 12, 2015
    Messages:
    86
    Likes Received:
    29
    Thank for that! Appreciated! :) I understand what you were trying to do now and must say the game looks promising! :) Looking forward to it. What platforms will you release it on?
     
  16. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    Thanks @mobile_gamegraphics, I'll roll it out on iOS first to get some data back, then follow up with other platforms.
     
  17. sysads

    sysads Serious Boxer

    Joined:
    Oct 8, 2015
    Messages:
    885
    Likes Received:
    353
    Would love someone to show just a quick step by step video if possible. My brain is spinning here while trying to understand this :confused:
     
  18. chadh0130

    chadh0130 Boxer

    Joined:
    May 21, 2016
    Messages:
    7
    Likes Received:
    8
    @phil - any chance you still have the video around? I've been searching far and wide to try this same concept. It's a bit tricky. I want to have a "lazer" at the top of the screen and as the character gets within a certain distance, it spawns the lazer animation. But don't want the lazer animation to continuously loop
     
  19. mobile_gamegraphics

    mobile_gamegraphics Boxer

    Joined:
    Oct 12, 2015
    Messages:
    86
    Likes Received:
    29
    @Phill Mason - I agree with Chad - you able to upload the video again? :)
     
  20. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    mobile_gamegraphics likes this.

Share This Page