Jump to content

Tilemap Parallax System


Recommended Posts


So I'm kinda stumped as to how to troubleshoot this.  I just kind of tossed this together and its really badly formatted but I will clean it up later when I have time.

First problem is it seems like my shader is off somehow, no matter how i sample the "tiles" texture it seems to not output what I expect.  I have a sneaking suspicion its an error in the shader...

Anyone have any idea why I cant get the atlas to display correctly?

*EDIT* :

Ok I am way closer now, just got to get the tile scaling to work correctly and then get rid of the repeating of it then extend some of the functions...  but basically got it figured out now.

Ok I got it for the most part now, just need to finish up some other things on it and I will start using it in a demo.  Might have to refresh a couple of times until the graphics all load.

Link to comment
Share on other sites


Ok I have finished up quite a bit more.

Fixed the async buffer loading issue, got the parallax effect working and added some other functionality.  I will soon start working on animated tiles, and then the ability to add sprites to a layer.

Anyone have an idea of the best way to set up animated tiles,  I was thinking of using the blue and alpha channels of the tile image to control the frames and timing, but then would not have a channel left for collision states of tiles... so Im not sure whats the best way to go about this.  Maybe a secondary tile texture for collisions/triggers.


Ill do a prettier/smoother demo soon with maybe like 3 or 4 layers.


Now to figure some stuff out though,  I want to somehow figure out what "tile" is clicked when the scene is interacted with so I can make like and editor for levels.

Link to comment
Share on other sites

Starting to get more of the things I want done with this finished up!
Here is click interactions with the shader in the unit sizes of the tiles.

Click somewhere on the screen near the center and you will see the tiles update.

getting through some more of the minor stuff, and then Ill post a demo showing off all the features.

Development Tasks:

Convert all textures to dynamic even if a img is loaded from a URL.
Pxl Perfect Lighting.
Multiple Sub-Layers Per Plane Layer.
Collision Data on tile reference image.
Finish Up Animation System.
Add "Actor" sprite shader and control object.
Different Click modes for repeating/non-repeating maps.
Small fixes to the shader for more configuration options.

Maybe a different unit system, to fix the clicking scale bug.

Link to comment
Share on other sites

So I got a weird thing happening with my animations.
Everything "works", but I had to go about it in a different manor then what was first thought out.

Anyways the odd thing that is happening is the numbers 3.,6.,7. do not see to work.  What I am doing is referencing a texture on the shader that tells the atlas what tiles have an animation by using the red channel for the animation type (I kinda cheated and hard coded different instances this time just to get moving on other things).  I then use the green channel to increase the speed of animations, and the alpha to slow or turn off animations. All of that works!  but... 3, 6 and 7 do not seem to trigger in the code when I use them on the map...  Im confused because if they did not work the other parts of the shader that use the same method should not work... so Im kinda thinking it is in the way that the floats are being calculated or maybe some kind of rounding is being applied?

Here is the code:

and here is an Example:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...