Animated textures
8 posts • Page 1 of 1
Animated textures
Here you are. Function for make animated texture.
And here it is advanced version - play animated texture once after "start" time and stop on last frame (for example in can be used on spawned geometry):
- Code: Select all
Scene.my.ATx := (tx, cols, rows, fps)=>{[tx(0)/cols, tx(1), (.5+math.toInt(sim.time*fps))/cols, tx(3), tx(4)/rows, (-.5-math.toInt(sim.time*fps)/cols)/rows, tx(6), tx(7), tx(8)]}
And here it is advanced version - play animated texture once after "start" time and stop on last frame (for example in can be used on spawned geometry):
- Code: Select all
Scene.my.ATx1 := (tx, cols, rows, fps, start)=>{(sim.time-start) < (1.0*cols*rows/fps) ? [tx(0)/cols, tx(1), (.5+math.toInt((sim.time-start)*fps))/cols, tx(3), tx(4)/rows, (-.5-math.toInt((sim.time-start)*fps)/cols)/rows, tx(6), tx(7), tx(8)] : [tx(0)/cols, tx(1), -.5/cols, tx(3), tx(4)/rows, .5/rows, tx(6), tx(7), tx(8)]}
Last edited by Kilinich on Mon Jul 05, 2010 6:56 pm, edited 3 times in total.
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: Animated textures
Wow.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Animated textures
Dang that is cool
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Animated textures
Woow .That was just plain awesomness! can't understand it though..
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Animated textures
Rideg wrote:Woow .That was just plain awesomness! can't understand it though..
the function is repositioning an image that includes all animation frames. you can see the image on the left side of the animation
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Animated textures
I don't know much about dedicated animation programs, but you could output these kinds of images by using GameMaker's built-in sprite editor. You can load animated gifs, and save them as a strip (in bmp format).
Link: "Surely somebody hates Walter Cronkite.."
Sonic: "Probably.. But somebody hates everyone."
Sonic: "Probably.. But somebody hates everyone."
-
link0007 - Posts: 408
- Joined: Thu Jun 11, 2009 2:45 pm
Re: Animated textures
Kilinich wrote:Now make image with frames (any size any col/row), apply it on geometry and set textureMatrix property to:
{scene.my.atx(default_textureMatrix, cols, rows, fps)}
Important: Always use float values in default texturematrix (0.0 not 0, 1.0 not 1)!
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: Animated textures
Ah i see what u mean i like ur script
- fox11trot
- Posts: 62
- Joined: Tue Sep 01, 2009 7:25 am
8 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests