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

learn more… | top users | synonyms

1
vote
1answer
2k views

How to initialize a BitmapDrawable Android

I have been using a shapeDrawable object for my android games player but now that i want to add some graphics in I have to use something different I was thinking of a BitmapDrawable but as I am new to ...
0
votes
1answer
1k views

Simple javascript HTML5 canvas start menu

I'm currently looking for a simple and basic start screen for a game using javascript, so basically its the first function that is called and then press play which then goes into the game. Looked ...
1
vote
1answer
987 views

Implementing a camera on HTML5 canvas?

I am trying to work out the best way of implementing a camera in my simple 2d game. The way it is structured at the moment is my game objects all have draw functions, which are passed a canvas ...
20
votes
7answers
9k views

HTML5 Game (Canvas) - UI Techniques?

I'm in the process of building a JavaScript / HTML5 game (using Canvas) for mobile (Android / iPhone/ WebOS) with PhoneGap. I'm currently trying to design out how the UI and playing board should be ...
2
votes
2answers
1k views

Receiving keyboard events on a canvas in Javascript

I need to receive keyboard events in a canvas element. Click events are received but key presses aren't. Here is my code which doesn't handle key events: var canvasElm = $('canvas'); ...
1
vote
3answers
4k views

Slow Firefox Javascript Canvas Performance?

As a followup from a previous post, I have been trying to track down some slowdown I am having when drawing a scene using Javascript and the canvas element. I decided to narrow down my focus to a ...
1
vote
1answer
322 views

How to create an array of images on a canvas

I am developing a game that uses different images.When am image is swiped to the bottom of the screen it disappears and a new image appears at the top.Seeing as you can't delete an individual image I ...
6
votes
3answers
850 views

Basic isometric projection in Javascript

I've been working on porting an old closed source game to Javascript with Canvas and I've come to a slight problem. Right now, to display the land, I just have a pretty basic loop that just draws the ...
0
votes
2answers
558 views

Animating sprites in HTML5 canvas

I'm creating a 2D platformer game with HTML5 canvas and javascript. I'm having a bit of a struggle with animations. Currently I animate by getting preloaded images from an array, and the code is ...
2
votes
1answer
311 views

Collision detection problems - Javascript/Canvas game

What I want to do: I simply want the have a 2D array to represent my game map. I want a player sprite and I want that sprite to be able to move around my map freely using the keyboard and also have ...
0
votes
1answer
298 views

Player movement behind objects

I was playing around on RPG JS and Browser Quest, and the player, when moving, can give the effect of walking behind the trees or houses etc, so the player effectively disappears while it is "behind" ...
5
votes
1answer
763 views

Canvas animation drops to 30fps every 3-4 seconds

Ok! I solved the problem. Chapter One - Multiple Canvases I started to make pong utilizing requestAnimationFrame and I noticed that the ball was stuttering and slowing down every 3-4 seconds. So I ...
2
votes
1answer
149 views

Difference between rotation methods?

My question is in about rotate methods in android.graphics.Camera. In Docs, I saw these comments: public void rotateX (float deg) Since: API Level 1 Applies a rotation transform around the X ...
-1
votes
2answers
327 views

Remove enemy when bullet hits enemy

For my education I have to make a basic game in HTML5 canvas. The game is a shooter game. When you can move left -> right and space is shoot. When I shoot the bullets will move up. The enemy moves ...
-5
votes
2answers
550 views

A* mouse movement javascript top-down game

Im trying to implement a* path finding for my character movement in my game. The game is written in javaScript along with jQuery in a canvas. I have read up on A* so i believe i understand what it ...
23
votes
3answers
6k views

Double buffering on HTML5 Canvas game?

My simple canvas game seems to work fine on Chrome and FF on Mac/Linux. I haven't had chance to test it on smart phones or Windows environments yet. It doesn't use double buffering but I have seen ...
1
vote
3answers
751 views

Need Guidance Making HTML5 Canvas Game Engine

So I have some free time this winter break and want to build a simple 2d HTML5 canvas game engine. Mostly a physics engine that will dictate the way objects move and interact(collisions, etc). I made ...
-1
votes
1answer
338 views

Drawing polygons in 3D

I have recently been working on a 3D engine from scratch, using JavaScript and HTML5. I've successfully created lines (although slightly buggy) and points, but I can't figure out faces. My current ...
3
votes
1answer
496 views

Animating DOM elements vs refreshing a single Canvas

A few years ago, when the HTML Canvas element was still kinda fresh, I wrote a small game in a rather "unusual" way: each game element had its own canvas, and frequently animated elements even had ...
3
votes
3answers
1k views

HTML5 Canvas Game Timer

How to create good timer for HTML5 Canvas games? I am using RequestAnimationFrame( http://paulirish.com/2011/requestanimationframe-for-smart-animating/ ) But object's move too fast. Something like ...
0
votes
1answer
247 views

Box2dWeb positioning relative to HTML5 Canvas

I'm new with HTML5 canvas and Box2DWeb and I'm trying to make an Asteroids game. So far I think I'm doing okay, but one thing I'm struggling to comprehend is how positioning works in relation to the ...
0
votes
1answer
837 views

HTML5 platformer collision detection problem

I'm working on a 2D platformer game, and I'm having a lot of trouble with collision detection. I've looked trough some tutorials, questions asked here and Stackoverflow, but I guess I'm just too dumb ...
1
vote
2answers
155 views

Which structures to use for maintaining 2D objects on canvas? How to map clicks to objects?

I need to draw some 2D objects on a canvas. And I need to map the 2D coordinates of clicks to objects. What is the usual way to maintain a 2D object's size and position (which data structures, ...
1
vote
0answers
274 views

Drawing two orthogonal strings in 3d space in Android Canvas?

I want to draw two strings in canvas. The first string must be rotated around the Y axis, for example 45 degrees. The second string must start at the end of the first string and also it must be ...
2
votes
3answers
653 views

Issues with shooting in a HTML5 platformer game

I'm coding a 2D sidescroller using only JavaScript and HTML5 canvas, and in my game I have two problems with shooting: 1) Player shoots continous stream of bullets. I want that player can shoot only ...
2
votes
1answer
226 views

How to shift a vector based on the rotation of another vector?

I’m learning 2D programming, so excuse my approximations, and please, don’t hesitate to correct me. I am just trying to fire a bullet from a player. I’m using HTML canvas (top left origin). Here is a ...
0
votes
1answer
463 views

Z axis in isometric tilemap

I'm experimenting with isometric tile maps in JavaScript and HTML5 Canvas. I'm storing tile map data in JavaScript 2D array. // 0 - Grass // 1 - Dirt // ... var mapData = [ [0, 0, 0, 0, 0], ...
8
votes
5answers
537 views

What implications does JIT (javascript/canvas) vs. AOT (Flash) have in terms of browser based game performance?

In my experience, even till this day, I still see more of a visual lag in entity movement / animation in JavaScript (Canvas) based games than I do in Flash based games. Why is this - what exactly is ...
5
votes
3answers
1k views

HTML5 game programming style [closed]

I am currently trying learn javascript in form of HTML5 games. Stuff that I've done so far isn't too fancy since I'm still a beginner. My biggest concern so far has been that I don't really know what ...
3
votes
2answers
225 views

Android Array Lag?

I am making a platform game for Android. It is sort of a tile based game. I added bullets and enemies with AI and a bunch of tile types. I created a simple map with no Enemies. Everything was running ...
1
vote
2answers
1k views

Is it possible to convert file from Blender 3d to svg?

I want to build web game in html5 with canvas/svg. Can I convert/export file from blender to canvas/svg? Maybe via unity3d?
-2
votes
2answers
76 views

canvas graphic output doesn't work [closed]

at the moment i'm developing a 3D-Vector-Coordinates-to-2D-Canvas-Calculation. the code is ready, the canvas too, but something doesn't work right... You can find my code at ...
1
vote
1answer
276 views

Recreating Doodle Jump in Canvas - Platforms spawning out of reach

I have started to recreate Doodle Jump in HTML using Canvas. Here's my current progress. As you can see, if you play it for a few seconds, some platforms will be out of the player's reach. I don't ...
3
votes
2answers
3k views

Smooth animation on a persistently refreshing canvas

Yo everyone! I have been working on an Isometric Tile Game Engine in HTML5/Canvas for a little while now and I have a complete working game. Earlier today I looked back over my code and thought: ...
5
votes
1answer
860 views

Javascript Canvas Drawing Efficiency

I have just recently started some experiments with game development in Javascript/HTML5, and so far it has been going pretty well. I have a simple test scene running with some basic input handling, ...
7
votes
2answers
4k views

Free movement in a tile-based isometric game

Is there a reasonable easy way to implement free movement in a tile-based isometric game? Meaning that the player wouldn't just instantly jump from one tile to another or not be "snapped" to the grid ...
2
votes
0answers
80 views

How to work with edge Texture [duplicate]

Im not sure if i use the right terms, but im not able to find something to start with. Im trying to develop a little HTML5 game. I have a ground with a texture and now I want to make a surrounding ...
1
vote
3answers
1k views

Android, how important is deltaTime?

Im making a game that is getting pretty big and sometimes my thread has to skip a frame, so far I'm not using deltaTime for setting the speed of my different objects in the game because it's still not ...
6
votes
2answers
896 views

android multitouch problem

Im aware that there a a couple of posts on this matter, but Ive tried all of them and none of them gets rid of my problem. Im starting to get close to the end of my game so I bought a cabel to try it ...
0
votes
1answer
461 views

Why does my health bar disappear whenever my character takes amage?

Im making health bar for my game that looks like this: public void healthBar(Canvas canvas) { float healthScale = happy.getHP() / happy.getMaxHP(); Rect rect = new Rect(20, 20,(120 * ...
3
votes
2answers
2k views

how to solve ArrayList outOfBoundsExeption?

Im getting: 09-02 17:15:39.140: E/AndroidRuntime(533): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 09-02 17:15:39.140: E/AndroidRuntime(533): at ...
-2
votes
1answer
415 views

Direction of the bullet - how to have something else than left, right, top, bottom

I'm making a simple shooter game using canvas and javascript. The current code can be seen here. To know which way I want the bullet to be shot, I simply have a direction property that can have 4 ...
0
votes
2answers
918 views

Calculating angle between two vectors to steer towards a target

I have been trying to implement a path following steering behaviour for AI in a 2D racing game. I have two vectors: futurePosition represents the predicted future position given the car's current ...
0
votes
2answers
494 views

Platformer movement and collisions

I'm working on a platformer but I'm stuck at the player movement and collisions. Right now I'm not including the grid at all in the movement, but it's time I do it. I've read this article on how to ...
39
votes
7answers
2k views

Managing text-maps in a 2D array on to be painted on HTML5 Canvas

So, I'm making a HTML5 RPG just for fun. The map is a <canvas> (512px width, 352px height | 16 tiles across, 11 tiles top to bottom). I want to know if there's a more efficient way to paint the ...
2
votes
3answers
1k views

Text fields in a java canvas

So I'm trying to have some form of input in my game and I understand all the keyPresses and whatnot but the only issue is I have no idea of adding a textfield to the game. JTextfield doesnt seem to ...
2
votes
2answers
1k views

Javascript Isometric draw optimization

I'm having trouble with isometric tiles drawing. At the moment I got an array with the tiles i want to draw. And it all works fine until i increase the size of the array. Since I draw ALL tiles on ...
1
vote
1answer
1k views

JavaScript rendering: Canvas or DIV?

I am planning on developing a multiplayer RPG (kinda like RuneScape, but don't worry, with a different gameplay) and i want to do this in the browser. Now before saying things like "A MMORPG is hard ...
1
vote
1answer
810 views

HTML5 Canvas Depth Sorting

I'm have problem with Isometric. I'm don't know how to name this "problem", but I'm show you some sceen what I get and what I'm need to get. My code now drawing something like: ...
1
vote
1answer
1k views

Easy way to do gravity in a simple game?

I'm looking for an easy, beginner friendly way to do gravity in a platformer. I've looked into Box2D tutorials, but they all seem very complicated. All I want is a class that takes into account if my ...