Animation Tutorial
9 posts • Page 1 of 1
Animation Tutorial
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
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
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:
This is the code in the texture= of the object:
That'll give you your exhaust animation!
This is an example scene/ proof of concept:
[scene]51814[/scene]
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--}
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]
-
TC42 - Posts: 984
- Joined: Sun Jan 09, 2011 1:53 pm
- Location: $ sudo apt get-install sandwich_
Re: Animation Tutorial
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]
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...
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.
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.
-
Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: Animation Tutorial
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 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 AND I'll make it without scene.my variables to appease the phunlet-gods
Back on topic, I think I'll make an explosion animation so I can make an algonuke AND I'll make it without scene.my variables to appease the phunlet-gods
-
TC42 - Posts: 984
- Joined: Sun Jan 09, 2011 1:53 pm
- Location: $ sudo apt get-install sandwich_
Re: Animation Tutorial
I'd photoshop the pictures toghether to make a big texture of them. I'll doublep-post the scene momentarely
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Animation Tutorial
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!
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Animation Tutorial
The S-Wire thing is just a bunch of alternating colliders.
The circles at the upper right effectively have this code:
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:
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:
Matthias Wandel is epic, in my humble opinion.
I love my brain...
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.
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.
-
Someone Else - Posts: 1147
- Joined: Sun Nov 21, 2010 10:53 pm
- Location: The Milky Way Galaxy
Re: Animation Tutorial
Never thought of modifying texturematrix before, but that's because I had never known exactly what it does and how to use it. Gold star for you, Raydeg! Also, I will soon be making a RPG/FPS-like game with an overhead view.
-
TC42 - Posts: 984
- Joined: Sun Jan 09, 2011 1:53 pm
- Location: $ sudo apt get-install sandwich_
Re: Animation Tutorial
BTW, did you already see that? viewtopic.php?f=13&t=1395
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Animation Tutorial
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!!
-
TC42 - Posts: 984
- Joined: Sun Jan 09, 2011 1:53 pm
- Location: $ sudo apt get-install sandwich_
9 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests