Animation Tutorial

Post your tutorials here.

Animation Tutorial

Postby TC42 » Thu Feb 17, 2011 12:54 am

Did you know that you can make animations in your scenes (eg., props spinning, neon signs, exhaust, nuclear test facilities, particle-acceleration-simulator-results-test-hypothesis, ect.)?!

Well, you can.

First, find some textures (Or if you're like me, get seriously annoyed at google images and make the textures your own darn self in photoshop) Each one should be one frame of the animation. Title them all the same name, with one difference-- the frame number. Also, make them PNGs.

Example:
exhaust_1.png
exhaust_2.png
exhaust_3.png
exhaust_4.png
exhaust_5.png
exhaust_6.png

Then, you need something like a beacon, except slower. Like the rotating block in my scene. The collision/laser-hit rate will be the frame rate.

Create a variable, like scene.my.texture1=0, type it into the console and press enter; it should return '0'

Now on the collider/laser, type
Code: Select all
{scene.my.texture > 5} ? {scene.my.texture = 1} : {scene.my.texture = scene.my.texture + 1}

Note that this code will make your animation loop, not just run once.

Now go to the thing that will hold the animation (e.g., a blank rectangle) and type
Code: Select all
{"--text of frame title goes here--_" + scene.my.texture <----the variable you created earlier--}
into the place where it says texture= ""

Now press play, and you will see your animation on this object!

EXAMPLE:

These are your textures, placed in the algodoo texture menu:
exhaust_1
exhaust_2
exhaust_3
exhaust_4
exhaust_5
exhaust_6

This is the variable that you've created:
scene.my.exh=0

This is your collider/laser code:
Code: Select all
{scene.my.exh > 5} ? {scene.my.exh = 1} : {scene.my.exh = scene.my.exh + 1}


This is the code in the texture= of the object:
Code: Select all
{"exhaust_" + scene.my.exh}



That'll give you your exhaust animation!
This is an example scene/ proof of concept:

[scene]51814[/scene]
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Animation Tutorial

Postby Someone Else » Thu Feb 17, 2011 3:11 am

Personally, I would use controllerAcc to store scene.my.whatever, and put all the code into one box. Whenever it is touched, its own texture changes. And it's phunlet-safe. And I am practically opposed to scene.my variables.
But, still, pretty good tutorial.
Speaking of which, I should get back to this S-wire project I am working on. And maybe post it here for no apparent reason.
And that was random.
[/random]
[/off-topic]
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Animation Tutorial

Postby TC42 » Thu Feb 17, 2011 4:49 am

I really never intended to make anything phunlet friendly; most animations that I will make in algodoo/phun will be scene specific, unless I make a generic explosion animation for tank games and similar stuff. So I always use scene.my variables; it makes life so much simpler for me :D I'll try to do some debugging on your s-wires, if I can understand how they work.

Back on topic, I think I'll make an explosion animation so I can make an algonuke :D AND I'll make it without scene.my variables to appease the phunlet-gods :angel:
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Animation Tutorial

Postby Rideg » Thu Feb 17, 2011 11:32 am

I'd photoshop the pictures toghether to make a big texture of them. I'll doublep-post the scene momentarely
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Animation Tutorial

Postby Rideg » Thu Feb 17, 2011 11:57 am

Rating: rated 6.9
Filesize: 172.78 kB
Comments: 14
Ratings: 7
download

Read description for explaination. I hope this can help as it takes up almost no resources(exept for the texture). No advanced functions and ofcourse, phunlet safe! :thumbup:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Animation Tutorial

Postby Someone Else » Thu Feb 17, 2011 7:38 pm

The S-Wire thing is just a bunch of alternating colliders.

The circles at the upper right effectively have this code:
Code: Select all
collideWater = !collideWater

so they will change collideWater onCollide. And they will only collide when the collideWater of the two are different- they are also on heteroCollide. Don't ask how that works, my best pondering failed.

The chain thing, however, uses an IF statement so it checks its own collideWater and changes collideWater, color, and textureMatrix accordingly. And none of that ever happens.

I think it's a subtle syntax problem, because I have gotten collideSet-based alternating colliders to work with IF statements, and also the code above works, but the previous paragraph doesn't. Or maybe... IT'S A BUG!

For those too lazy to search Algobox:
Rating: rated 5.6
Filesize: 96.22 kB
Comments: 2
Ratings: 2
download
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Animation Tutorial

Postby TC42 » Fri Feb 18, 2011 3:08 am

Never thought of modifying texturematrix before, but that's because I had never known exactly what it does and how to use it. :D Gold star for you, Raydeg! Also, I will soon be making a RPG/FPS-like game with an overhead view.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Animation Tutorial

Postby Kilinich » Fri Feb 18, 2011 3:11 am

BTW, did you already see that? viewtopic.php?f=13&t=1395
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Animation Tutorial

Postby TC42 » Fri Feb 18, 2011 3:41 am

Kilinich wrote:BTW, did you already see that? viewtopic.php?f=13&t=1395


No, I hadn't, but now that I have... BWAHAHAHAHAHAHA!!
Thanks for pointing it out, and you beat me to it AGAIN!! :lol:
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests