Log In  

Hi. I am hoping to add animated water to my game by just using a few tiles that loop. I can't seem to find any good resources for animated background elements though. I mostly just find animations for characters or interactive objects.

EDIT: I greatly appreciate all of these responses. I guess what I'm asking is how do I animate an object? Most of what I find is how to animate a player so it's generally based off of "if btn(0) then..." But I just want a standalone animated object that's constantly in loop throughout the game.

P#45316 2017-10-18 14:41 ( Edited 2017-10-27 14:52)

There's no way to have self-contained animated sprites/tiles, like a gif or something.

But if you had a background that could be drawn without sprites, like using draw functions, I guess you could animate without frames and just use the math. Not sure if your water would qualify but that's the only other way to get animations.

If you have tiles that you want to use for water, you just have to flip between the two like any other animated object.

At least if I understand your trouble...

P#45318 2017-10-18 15:21 ( Edited 2017-10-18 19:23)

Maybe just use map tiles for the background of the water and animated sprite elements on top? I guess what exactly do you need to animate?

Otherwise yeah maybe you could draw the background with tiles and then have a drawing function to animate pixels on top. I'm imagining like water ripples from a center point or something. Same effect as a bad guy blowing up and scattering to rings or something.

P#45333 2017-10-18 22:42 ( Edited 2017-10-19 02:42)

@MEMalguy: You're over thinking it.

Animate them the same as you animate anything else. If you're using map() then just use a timer (like for the weather) and when it counts down, use mset() to change the tile id to the next tile in the animation. It's the same as how you animate the bee.

P#45334 2017-10-19 00:46 ( Edited 2017-10-19 04:46)

You can also use pal() to remap certain colors to other colors... You can use this to simulate water flowing by strategically replacing certain colors so that it looks like it's flowing forward or backwards. IIRC the guy who made tempest ( https://www.lexaloffle.com/bbs/?tid=2186 ) did this so you can see a simple example of it there, but you could imagine a more complex example of tiled waves that are remapped like christmas lights so it looks like it's moving when it's just replacing colors in series.

The nice thing about this is it takes up less tiles, but it's of course a lot more limiting...

P#45345 2017-10-19 21:54 ( Edited 2017-10-20 01:55)

I guess if you're using map tiles you could set a flag on them and have the code check for tiles with those flags during the DRAW process to place animated bits above them. Even just a plain blue tile with random dots of lighter blue or white shifting about on top of the make a good wave effect. You might not even need to use sprites or tiles for this, But just code to add some "Noise" to each water tile.

..Shouldn't be too hard to do and it's something I gotta do eventually for my submarine project eventually so I'll see if I can't whip up an example sometime today.

P#45359 2017-10-20 11:46 ( Edited 2017-10-20 15:46)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 11:27:32 | 0.014s | Q:20