A new feature of HTML5, allowing Javascript apps to have a drawing surface in the browser.

learn more… | top users | synonyms

2
votes
0answers
18 views

Creating HTML5 Canvas Objects in Javascript

I'm currently trying to learn how to make HTML5 Canvas games with JavaScript. I would like to use object oriented JavaScript to manage the elements of the game, but i'm having trouble. I've done a lot ...
-2
votes
1answer
38 views

How do I clear the previous frames of a canvas animation?

I am trying to rotate an object, but all the previous frames still show up on the canvas. Here is my code. This didn't work: this.ctx.clearRect(0, 0, this.canvas.canvasWidth, ...
0
votes
1answer
33 views

android canvas rope swing

I'm creating the code, where a player swinging on a rope for the moment I got this double angle = Math.atan2(player_y - center_y, player_x - center_x) - Math.atan2(end_y - center_y, end_x - ...
1
vote
0answers
9 views

Donut-shaped / inverse mask in Phaser

I am trying to get a donut-shaped mask in Phaser (essentially the inverse of a regular mask). The mask shape is dynamic so it needs to be a Phaser.Graphics polygon object. Desired result: The blue ...
0
votes
0answers
15 views

UV texture mapping with perspective correction works for 50%

So, I've been trying to get the UV texture mapping down with perspective correction. The triangle rasterization seems to work. The interpolation seems to work too. It's just the perspective ...
1
vote
1answer
36 views

Tiled - move all tiles

I'm making a map in Tiled. I quickly ran out of room in the north of my map and would like to "shift" the tiles down. I'd prefer not to have to redo each of the tile layers. Is this possible? This ...
0
votes
1answer
37 views

Why can't CSS Sprites handle vectors?

Almost all the documentation available either says that "sprites are bitmaps" or that "css sprites must be bitmaps". Is there a specific reason for this? Is it, in fact possible to create a css sprite ...
0
votes
0answers
36 views

How to draw my android Hexagons in a grid?

I am trying to create a hexagon grid using the Android ’Canvas’ package. I have a working ’Hexagon’ class that when used in a view will draw a single hexagon on screen. The problem is that I need many ...
1
vote
0answers
39 views

Javascript 2D top down handling player direction graphics

In my top down game I can move the character around and the character will even face the direction he is moving however there is some weird behavior I'm having when you hold down one direction and ...
3
votes
1answer
179 views

Roguelike 2D Collision Detection

I'm just a normal guy trying to do some basic collision detection but I suck at it. I either get stuck in a wall or I go in reverse in the wrong direction trying to update the player position to a non ...
-1
votes
1answer
59 views

Adding obstacles & collision to canvas game

I am trying to add some obstacles to the canvas game that I've got but something seems to be wrong and I can't seem to put my finger on it. I just want some simple walls here and there to make the ...
0
votes
0answers
80 views

2.5D platform Android Game

I am a beginner to game development, so far I just made a top/down scroll shooter with canvas in Android, and I now wanto to make a 2.5D platform game like good old SNES, I am thinking of making it ...
0
votes
1answer
67 views

svg spaceship game movement 2d

I've been searching for a way to make an svg box move to all directions using js. I have seen many tutorials on how to do it grid like, but I want it so have a square that can turn, move forward, ...
1
vote
0answers
80 views

Card Masking in Phaser

Good Day, I'm new to Phaser and still learning about it to. I am challenging my self to create a simple animation of a card flip somewhat realistic rather that making use of a scale. This is ...
0
votes
1answer
35 views

Rectangles clear each other when moving on canvas

I am having this problem after moving rectangles, they seem to delete one another. Most probably it is a problem with clearRect(...) method. This is the clean function I am using: clean: ...
0
votes
0answers
17 views

CocoonJS draws shadow around tiles

I am using CocoonJS launcher on iOS for a simple tiled game. Calling canvas drawImage for tiles adds a shadow or ghost border around tiles. See this screenshot: ...
1
vote
1answer
218 views

Cocos2D-JS Windows App in fullscreen mode (Win32)

I've been looking for a way to make my Cocos2D-JS app go into fullscreen mode, but there doesn't seem to be much documentation on Cocos2D-JS (or Cocos2D-x-js as some seem to call it.) This app is to ...
0
votes
0answers
49 views

possible way to bring canvas 2d animation in canvas webgl context

when added 2d animation canvas in 3d webgl canvas as texture, 2d animation and 3d animation both stopped working. Any reference for this.
0
votes
0answers
69 views

Collision detection in JavaScript Canvas game - Issue with 'if' statements [duplicate]

I am currently developing a simple browser-based game and seem to be on the cusp of collision detection that doesn't just return the player to where they were before, but actually will slide them ...
2
votes
1answer
197 views

How can I create 2D, sprite-based reflections in HTML5 Canvas?

I'm trying to create simple reflections in a 2D, sprite-based game using HTML5. I'm looking to recreate an effect like the one you'd often see in GBA games, such as Pokemon Emerald and Mother 3: ...
0
votes
1answer
377 views

Rotate arrow on canvas

I need to draw a flow dynamically based on some user choices. In that flow I want to draw the choices (blue circles with number) and the directions of that choices (line and arrow). For example: node ...
0
votes
1answer
246 views

Game sprite far too small

So I started writing an Android 2D game. I've come to the point where I want to display my character image on the screen. I read that most sprites have a resolution of 16*16, or more. So I created an ...
0
votes
0answers
28 views

Reverting 2d canvas?

I'm making a multiplayer game which involves drawing lines. It's based this game: http://curvefever.com/sites/default/files/resize/remote/ef86488088c618df13b34f8b87aafd4e-1107x808.jpg. The game is ...
2
votes
1answer
141 views

How to implement user friendly screen panning on 3D HTML canvas for RTS game

How can I get RTS map panning like how it was done in C&C red alert (with the mouse at the edge of the screen moves the screen in that direction) with a Babylon.js RTS game in the html canvas? ...
3
votes
1answer
695 views

Why would it be faster to render using multiple canvas elements?

This video suggests that rendering using multiple canvas elements helps performance. How does this work? The idea was to use one for the player, one for the enemies, another for the background, ...
0
votes
1answer
97 views

Set a different animation rate for moving player NOT using a sprite

I am trying to start making a simple game using HTML5 with a canvas and some JS. I have a player whose movement I am comfortable with, but the rate at which the player animates when it moves is too ...
0
votes
0answers
60 views

Drawing to canvas on a low end Android device

Recently I have noticed some of the low end Android devices have issues running my game. I've managed to get a screenshot of this bug: Once game is running, only the top left corner image will ...
1
vote
1answer
390 views

What is the difference between a Facebook Canvas and Facebook Web project?

I am making a game on cocos2d-JS for Facebook. What is the difference between Facebook Canvas & Facebook Web project. From what I can tell, Facebook Canvas ask for the secure url and Web ask for ...
1
vote
0answers
159 views

Shadows in html5 canvas game

I'd like to ask for reference. I met an article about how to cast shadows in games. I'm using html5 canvas (currently without webgl) with javascript for my projects. The article mentioned above is ...
0
votes
2answers
117 views

How to access bottom canvas layer in HTML?

I have such html: <div id="main_window"> <canvas id="canvas_hex_logic" width="200" height="100"></canvas> <canvas id="canvas_ground" width="200" height="100"></canvas> ...
0
votes
1answer
84 views

Initial force to achieve orbital velocity

I'm attempting to get asteroid to orbit a black hole that is asserting gravity. Some parts currently work, like the black hole asserting gravity, attracting asteroids in and destroying them. And ...
0
votes
1answer
388 views

Creating looping canvas animation (slot machine with reels)

I have a small assignment to create something like slot machine with spinning pictures. I have to use HTML5 Canvas. I would like to hear some opinions how this can be made simply and performantly. ...
1
vote
0answers
205 views

Simple track method for 2D car game? [closed]

I'm a new programmer and I am trying to make a 2D car game on an html5 canvas with javascript and JQuery. I have got the basic car motion down, check it out here: ...
1
vote
2answers
87 views

Offset during zooming to keep object within boundries

I have a simple zoom feature which lets the user zoom in and out. I'm having an issue how ever when i zoom out the object gets smaller to the point that the boundaries become broken. The idea is the ...
0
votes
1answer
651 views

Android Canvas 2D Game: Supporting multiple screen sizes/resolutions [duplicate]

I'm planning to develop a 2D game for android devices by using simple Canvas Surfaces (I know that OpenGL might be more efficient - but Canvas should definitely be enough for my type of game). I'm ...
1
vote
1answer
224 views

How do I procedurally create a directional light cone with an HTML canvas?

To create a directional light effect, I want to draw this kind of transparency mask on an HTML canvas (using context2d): I also want to be able to generate such a mask dynamically. I've tried using ...
0
votes
1answer
220 views

Map scrolling around the world

I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to ...
0
votes
4answers
224 views

How to handle a negative coordinate 2d map with a growing map size

I love this procedural generation theory and have been messing around with it. However I'm having trouble wrapping my head around how to store my map data. Usually I store my map data in a 2d array ...
3
votes
3answers
974 views

Procedurally Generated Top View 2D RPG Map Generation

Procedural generation is a fascinating concept and is gaining popularity in the gaming industry. The thought of playing a game that has new content every-time the game is played is very exciting to ...
0
votes
0answers
92 views

Drawing a object with Box2D and HTML5 canvas on current mouse position

I'm attempting to create a air hockey type game with HTML5 canvas and JavaScript, using Box2dWeb for the physics calculation. I need a way to draw the puck at the current mouse x and y position every ...
1
vote
1answer
372 views

Removing a previously rendered image on a canvas

I made a platformer using ctx.clearRect and ctx.fillRect, so each time the player moved I would just delete the previous position and draw him again. Now I'm working on importing my own art into the ...
0
votes
2answers
456 views

How to move an image back and forth with javascript

I currently am trying to make a baseball game and have this code here: http://jsfiddle.net/769BK/ I have the baseballX set to a decrement, and then I try increasing the value using baseballX++; but it ...
0
votes
2answers
775 views

How to move an object using X and Y coordinates in JavaScript

I am making a 2d baseball game with JavaScript and HTML5 and am trying to move an image that I have drawn with JavaScript like so: //canvas var c = document.getElementById("gameCanvas"); ...
1
vote
2answers
422 views

How can I make EaselJS' skew behave like canvas'?

The skew property of a bitmap in EaselJS (given as angle) rotates the image such that it also flattens. I'd like to skew it without "squashing" it, as canvas does. JSFiddles, to demonstrate: Canvas ...
1
vote
2answers
99 views

How do you account for zoom in a top down viewport?

I've been stumped on this for days so please forgive me if this question is in bad-form. I have a generic top-down RPG structure, and I want to create a zoomable Canvas viewport for it. I've read ...
1
vote
2answers
225 views

Canvas - darken sprites rendered by drawImage

I am implementing lighting in a tile engine, and I need a way to darken tiles, based on their light level. For the ground tiles, I can clear the context to black, then set the globalAlpha and use ...
-1
votes
1answer
121 views

creating an html5 game [closed]

I am working on a really simple online version of the parachute shooters game that was preprogrammed on old iPods. I'm pretty new to game development and so at first I tried to build the whole game ...
2
votes
1answer
233 views

How do I use createPattern with a spritesheet? [closed]

Say that I have a spritesheet like this And I want to use the dirt tile at (1, 1). I know that I can repeat an entire image using createPattern but how do I create the pattern from just the tile ...
-2
votes
2answers
142 views

collision detection algorithm issue

here is the jsfiddle i am working on so far : http://jsfiddle.net/TLYZS/ if you debug the code and check the collision function you can see that the collision is working fine when the user overlap ...
1
vote
2answers
1k views

Dealing with multiple animation state in one sprite sheet image using html5 canvas

I am recently creating a Game using html5 canvas .The player have multiple state it can walk jump kick and push and multiple other states my question is simple but after some deep research i couldn't ...