Log In  

0

Would anyone happen to have advice on how to distort a small selection of pixels onscreen (For instance, an arbitrary 8x8 square)? I'm trying to add an effect where if the player bumps into a solid platform, that piece of the platform bends up with an effect similar to the arcade Mario Bros. game. I tried following the tutorial on wave distortions from PicoZine #2 but that seems to be based on distorting all tiles of a certain type on screen.

TL;DR, are there any tutorials you'd recommend for distortion effects?

visuals distortion effects
P#47962 2018-01-08 11:39 ( Edited 2018-01-12 22:02)

::

There are a lot of ways to do it. You could:

  • Animate the tile using sprites
  • Use sspr or primitives (rect, etc) to draw the tile a few pixels at a time and offset where they are drawn based on a timer... if you multiply that offset by how far the pixels are from the center of the tile, it would make a 'wave' effect
P#47963 2018-01-08 12:23

::

Thanks!!! Sorry for not being more clear but my main issue is that I'd like to be able to do the effect on the pixels directly. For instance, if the player hits directly between two tiles, I'd like the "bump" to appear centered at the point of impact, rather than one of the two tiles.

P#47968 2018-01-08 20:52

::

Same approach works:

  • get impact location
  • determine all affected tiles
  • draw these tiles using sponge effect
  • draw all other tiles as usual
P#47971 2018-01-09 04:50

::

I actually figured it out! I got the impact location, then used some clipping trickery and map-redrawing to make the bump effect. I'll put up the example once I make a bit more progress!

P#48100 2018-01-12 22:02

Log in to post a comment

user:
password:

New User | Account Help
:: New User
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2018-04-25 18:05 | 0.203s | 1572k | Q:13