-
+
Jaws Example #12 - TileMap() and ViewPort()
@@ -9,16 +10,16 @@
FPS: . Move with arrow keys.
-
+
TileMap and ViewPort optimizations
Here we have a Huge game world consisting of 700 x 700 tiles ( ~half a million sprites ).
We don't want to draw them all so we use viewport.drawTileMap( tile_map )
FPS: . Click a dirt tile to move. Find the hiding villain.
-
+
Example 14: Pathfinding and Line of Sight in a TileMap
-
+
Jaws Example #2 - on_keydown(), game states
-
+
FPS: . Move with arrows, shoot with space. Select with Return.
Game states
Minimalistic example using all jaws convenience methods and game states.
- Game states are an proven and robust way of separating various parts of the game.
+ Game states are an proven and robust way of separating various parts of the game.
For example: An intro, a menu, the actual game play, the high score list. That's 4 different game states right there.
A gamestate is just an normal javascript object with the methods setup(), update() and draw().
@@ -48,7 +49,7 @@
Every Sprite (that has an image) will have a function rect() which will return a Rect-object just embracing the sprite.
Then you can sprite.rect.collideRect(rect2) or sprite.rect.collidePoint(x, y)
Showing off the effects of setting different anchors for different sprites.
Set anchor when creating a Sprite:
ship = new Sprite({image: "spaceship.png", anchor: "center"})
With TileMap() we can fit game objects into a 2D array, we call it cells. You set the size for the cells, default is 32 x 32 pixels.
Once we have the objects in our tile map we can lookup game objects very fast.
-
+
jaws log
-
+
Jaws Example #9 - Viewport()
@@ -10,15 +11,15 @@
Move with arrow keys.
-
+