aquadraht Posted August 26, 2014 Share Posted August 26, 2014 Hello all, not long time ago, i experimented a little bit with canvas and tried to make a small car race in it. because i didnt know phaser, i started everything from scratch without any framework.but now that i know phaser, i love it and want to use it in my small game. but there is one thing i couldnt figure out how to do. maybe someone can give me a hint on how to start. how it was without phaser:i had a large jpg as background in canvas. the street was in black color, and offroad white ( background: https://github.com/daTobiGit/carRace/blob/master/images/map.jpg ) when i wanted to detect if the car is offroad, i took the pixel color (getImageData) from the background at the current position, and if it was different than black, the car was offroad. now with phaser, i dont find a way how to do that. i can still load the background in a canvas, and use getImageData again, but maybe there is a much better and faster way how to do that.maybe there is something with a tilemap, but the street cant be tiled properly, as it is painted ugly in m$ paint. maybe i can set a "street layer" somehow, and check collision or overlap with it?any help is appreciated! thanks in advancetobi Link to comment Share on other sites More sharing options...
rich Posted August 26, 2014 Share Posted August 26, 2014 Use a bitmapData, draw your "hidden road" image to it and getPixel on it. Link to comment Share on other sites More sharing options...
aquadraht Posted August 26, 2014 Author Share Posted August 26, 2014 this easy? now i feel stupid! ;-) thanks for the fast help Link to comment Share on other sites More sharing options...
jdnichollsc Posted August 13, 2015 Share Posted August 13, 2015 Hi my friend, How did it go with that? Regards, Nicholls Link to comment Share on other sites More sharing options...
Recommended Posts