Ensuring an enemy dies when a chameleon tongue animation is fully extended?

zackperkinszackperkins Member, PRO Posts: 11
I am currently developing a game with a Chameleon.....I have created a png animation sequence (from Toon Boom) for the tongue to shoot out. There are 6 images. When the image spawns, the shooting tongue animation is only as long or short as the first image you spawn. When and the animation starts, the enemy (mosquito) hits the the clear image box and dies before the tongue animation is fully extended?? How do I ensure the enemy dies when the tongue is fully extended?
Thanks, Zack

Best Answers

  • SocksSocks London, UK.Posts: 12,822
    edited March 2013 Accepted Answer
    @zackperkins

    When your tongue animation extends rather than use the actual actor (the animation is on) to detect the collision with the mosquito - have a second (invisible) actor to do the collision detection, this could be something as simple as a rectangle that you scale its length up and down to match the tongue extension.

    If it's only the tip of the tongue that is dangerous to mosquitos then it could even be a small circle (again invisible) that tracks the tip of the tongue.
  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer
    Thanks so much socks (I am programming and developing)....
    Another first class amphibology joke wasted. ;)
    That's a great idea....I've been experimenting with timing as Thomas said above....works pretty good. How do you get that small circle to track the animation (tongue extension)?
    Track it manually, as the tongue extends have an actor move along the length of the tongue.

Answers

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    Don't use the animate behavior. It has always been very glitchy, instead use timers or another method. Search around and you'll find some.
    - Thomas
  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    By the way, it looks like you still have 0 posts :D
    - Thomas
  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks Thomas, but not sure how to extend the tongue without animating it and getting it to hit an object to destroy it?
  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks again Thomas- I am new at this and guess I need to be more specific. That tutorial on Timers is great. Thanks for your time! And that would probably work if the mosquitos were come at a set time and distance. My chameleon is what the player will move and when a key is pressed, the tongue should shoot out (and back) and hit a mosquito......Again, the problem is that when the animation starts, the end of the transparent image box(actor) hits the mosquito and it dies before the animation can complete its full extension. Thanks a ton again....Zack
  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    I am currently developing a game with a Chameleon.....
    Which one of you two is doing the coding ?


  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks so much socks (I am programming and developing)....That's a great idea....I've been experimenting with timing as Thomas said above....works pretty good. How do you get that small circle to track the animation (tongue extension)?
  • SolarPepperStudiosSolarPepperStudios Member Posts: 754
    Well, I had something all typed up to tell you and it turns out it doesn't work. I'll experiment later if someone can't help you in the meantime.
  • zackperkinszackperkins Member, PRO Posts: 11

    Thanks Socks- that's funny....I totally missed it (forest through the trees...). Hopefully the Chameleon will help me in the future! LOL. I will give the manual tracking a try when I figure it out- thanks!
  • ericzingelerericzingeler Member Posts: 334
    Do this:

    Run your animation.

    In rule:

    If image = "NameOfLastImage"
    Action

    done!
  • zackperkinszackperkins Member, PRO Posts: 11
    edited March 2013
    Thanks Eric- I am not a coder though....Can you be a little more specific to walk me through it? What rule do I use, and where do I input this? Thanks
  • SocksSocks London, UK.Member Posts: 12,822
    I will give the manual tracking a try when I figure it out- thanks!
    You just have to move an actor the same distance and direction as the tip of the Chameleon's tongue.
  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks Socks- Using the "Move To" behavior?
  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks RThurman- But it looks like the videos from Firemaplegames can't be viewed? I downloaded the safari plugin, but to no avail?
  • SocksSocks London, UK.Member Posts: 12,822
    Thanks Socks- Using the "Move To" behavior?
    Yeah, that or interpolate or constrain or whatever best fits in with your game (or how you've put it together), there are lots of different ways to do this kind of thing.

    Here's a quick moving actor: (click on the square)

    http://www.mediafire.com/?u0u2r804d6dcr9u

    Imagine this is invisible and moves at the same rate and to the same distance/angle as the tip of your animated tongue.
  • ericzingelerericzingeler Member Posts: 334
    Thanks Eric- I am not a coder though....Can you be a little more specific to walk me through it? What rule do I use, and where do I input this? Thanks
    Just to confirm, are you using the animation behavior?

  • zackperkinszackperkins Member, PRO Posts: 11
    Yes- I am using an animation behavior. I am spawing the first tongue image just behind my chameleon. And that image actor has an animation sequence attached to it, so that when it spawns, it animates my 6 images in my image library- to make the tongue shoot out and back effect.
  • ericzingelerericzingeler Member Posts: 334
    edited March 2013
    Ok, so you need to trigger a switch at when the animation behavior is at a specific image. Place this after your animation. You need a rule as such:

    image
    edit in expression editor using quotes and no file extension
  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks Eric- Can you explain what that change attribute does? What is the self.functionStep and what does the "1" do? I am a noob I know- thanks for you time!
  • ericzingelerericzingeler Member Posts: 334
    The functionStep attribute is one that I created. Its not specific to anything outside the example I posted.

    I was simply demonstrating how you go about changing an attribute when the actor image name is equal to a specified image name.

    So now you know how to change an attribute when your animation gets to a certain image. The next step is to use that attribute in conjunction with the collision rule you're already using to destroy the actor.
  • zackperkinszackperkins Member, PRO Posts: 11
    Thanks a ton for your time Eric! I'm pretty impressed with this community forum- everyone is very helpful.....As I progress, I will definitely contribute!
Sign In or Register to comment.