Jump to content

Trying to create a lizard tongue


Elad Sofer
 Share

Recommended Posts

Hi,

 

I am using phaser and am new to game development and could not find a solution to this question anywhere:

I have a lizard character and want that when a mouse is clicked the mouth opens (i have that figured out) and a tongue will come out in a natural looking way to the point where i clicked and go back into the mouth after that.. 

 

I am clueless on where to begin and any leads or references will be great.

 

Thanks,

Elad.

Link to comment
Share on other sites

Thank you for this.

I have done it but it does not look very realistic...

Because the tongue sprite stretches it looks very unrealistic :(

Is there any other example that I can implement this in a snake like fasion, meaning that the base stays the same and the edge states the same but only the middle part stretches?

Let me elaborate:

How could I implement this:

the tongue base is an animation, after that a tween to stretch only the middle and keep the edges?

Thanks for your help,

Elad.

Link to comment
Share on other sites

I have found the solution that works for me (at least so far...).

 

I calculated an array of points leading for the mouth of the lizard to the point clicked.

And then i draw a base sprite and then repeat the "body" sprite as many times as needed and then draw the edge of the tongue.

To create the "extraction" animation i start with 3 points (base,mid,edge) and incrementally draw more middle sprites and move the edge accordingly.

 

Does that make sense? Is there a more elegant way of doing this in phaser (reminder - i am a complete newbie to phaser \ javascript \ game development)

What do you think?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...