Jump to content

Editiing image tint before placing it on tilemap.


Recommended Posts

Hey guys, just getting started with Phaser and it looks amazing. I've been working with pixi for about two years but i just can't figure this one out.


I'd like to edit the image tint before adding it to the tilemap, or while it's on the tilemap.


Here's what i currently have:

var testMap = [[0,0,0,0,0,0],               [0,1,0,1,0,0],               [0,1,1,1,1,0],               [0,1,0,1,0,0],               [0,0,0,0,0,0]]var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });var map, layer1, sprite;function preload() {    game.load.image('tile_ground', 'assets/ground.png');}function create() {    map = game.add.tilemap();    map.addTilesetImage('ground', 'tile_ground', 32, 32, null, null, 0);    layer1 = map.create('map1', 40, 40, 32, 32);    layer1.resizeWorld();    for (var x = 0; x < testMap.length; x++) {        for(var y = 0; y < testMap.length; y++) {            var testTile = map.putTile(testMap[y][x], x, y, layer1);            testTile.alpha = 0.5;        }    }}

Any suggestions/tips/help?

Link to comment
Share on other sites

Which results in this: http://i.imgur.com/xh6H2BQ.png


How would i for example change the colors of the blocks around me, to make it work with our custom lighting engine?


In pixi our tilemap would be redrawn every frame, but i can't figure out how to do something like this in phaser using the tilemap since it's only being drawn once.

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...