tiistai 12. heinäkuuta 2016

Locked doors


Today I added locked doors, so that the player will need a key to open them. I decided to keep the door in the collision map even when it is open, there is just a flag that tells that it wont collide with anything. Perhaps this will be a good decision, if I need to search for objects in an area.

The next step will be adding support for multiple levels, and portals between levels. I'll probably use MongoDB to make the levels more persistent.

I also made a grid to make editing levels easier. When the grid is on, the added elements will be added aligned to the grid, otherwise they will be added freely. Easiest way to add a grid is using THREE.PlaneGeometry with a wire-frame material. The formula for aligning into grid is ⌊v/λ+1/2⌋λ where λ is the grid size. I use rounding instead of floor because the my objects are centered to their position i.e. if the position of an object is (200,200), then that is the position of their center.


Ei kommentteja:

Lähetä kommentti