Code Monkey home page Code Monkey logo

twopointfive's Introduction

TwoPointFive for Impact

TwoPointFive is a plugin for the Impact HTML5 Game Engine that provides a 3D viewport for the game world.

Demo

Super Blob Blaster

A demo game that uses this plugin is included in this repository.

Please note that you need a license for Impact to actually run the demo. The lib/impact/ and lib/weltmeister/ directories from Impact need to be copied into the lib/ directory of this demo.

Usage

The demo game and its sources in lib/game/ should give you a good overview on how to use the plugin.

The most importantant thing for your entities is to subclass them from tpf.Entity rather than from ig.Entity. The tpf.Entity provides some capabilities to position and draw them in 3D space. Each entity has an additional .z property for .pos and .vel that determines its vertical position and speed in the world.

The layers in your level need to be named in a certain way for TwoPointFive to recognize them. The tile layers for the graphics need to be named floor, ceiling and walls. An additional light layer provides an additional tint for each of the tiles in the level. Note that the tilesize for each of these layers must be the same. Again, have a look a the included lib/game/levels/base1.js for an example.

TwoPointFive comes with some additions to Impact's Debug Module. To load it, simply require the plugins.twopointfive.debug module in your main.js.

A note about Tile Seams

Whenever drawing parts of an image in WebGL, such is done here when drawing tiles, WebGL may sample pixels from a region of the image that is outside the one you specified. This happens mostly due to rounding errors and will result in ugly seams between tiles.

TwoPointFive attempts to work around this issue by redrawing your tileset into a slightly larger image and adding a 1 pixel border around each tile. This 1px border is a copy of the neighboring pixels. Whenever WebGL now samples a texture slightly outside the tile boundary, it will sample from this 1px border and thus avoid any seams in your map.

If you do not want this behaviour, you can disable it by setting tpf.Map.fixTileSeams = false; before calling ig.main().

twopointfive's People

Contributors

phoboslab avatar joncom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.