passiomatic / mage-city Goto Github PK
View Code? Open in Web Editor NEWMage City, render Tiled maps in Elm and WebGL
License: MIT License
Mage City, render Tiled maps in Elm and WebGL
License: MIT License
From the docs:
When you use the tile flipping feature added in Tiled Qt 0.7, the highest two bits of the gid store the flipped state. Bit 32 is used for storing whether the tile is horizontally flipped and bit 31 is used for the vertically flipped tiles.
To enable variation while editing levels it would be useful to support at least horizontal and vertical tile flipping (we can add diagonal flip later). Flipping bits should be extracted by elmify
utility and possibly stored into the B channel of the LUT which is actually unused.
Then, shader would extract the bits and invert the final tile coordinated according to those values.
Note: I was assuming that WebGl 1.0 supports bitwise operations. It turns out this is not the case. However, since we need to test only two bits we can easily check against four hardcoded integer values (e.g. 0 = no flipping, 1 = flip h., 2 = flip v. and 3 = both h. & v. flip).
Allow to specify player start position for each level file, perhaps using the midpoint of a object named Player
.
Since the player start position could be thought as a spawn point, we could put that player
object into a specific layer, which contains all the information needed to spawn each entity in the game.
Discussion:
https://stackoverflow.com/questions/7615009/disable-interpolation-when-scaling-a-canvas/7665647#7665647
Relevant CSS:
canvas {
image-rendering: optimizeSpeed; /* Older versions of FF */
image-rendering: -moz-crisp-edges; /* FF 6.0+ */
image-rendering: -webkit-optimize-contrast; /* Safari */
image-rendering: -o-crisp-edges; /* OS X & Windows Opera (12.02+) */
image-rendering: pixelated; /* Awesome future-browsers */
-ms-interpolation-mode: nearest-neighbor; /* IE */
}
WebGL's DepthTest is wrong when dealing with multiple layers. See attached screenshot. More generally, having these as entityWith
settings:
entitySettings =
[ DepthTest.default
, Blend.add Blend.one Blend.oneMinusSrcAlpha
]
would make less
as default depth test, with a value of 0 meaning closer to the camera and a value of 1 farther to the camera. This seems not to be the case, in fact it seems to work backward.
To avoid page scrolling problems use W, A, S and D keys for player navigation.
Relevant function: http://package.elm-lang.org/packages/ohanhi/keyboard-extra/3.0.2/Keyboard-Extra#wasd
Example using both WASD: https://ellie-app.com/35nZJ9mySNja1/1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.