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

learn more… | top users | synonyms

1
vote
3answers
197 views

How do I correctly make character sprite direction match player inputs?

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 ...
0
votes
1answer
29 views

Updating code to include states

The Problem I am having a problem in that I am finding it hard to understand how to update my current code so that it uses states. I am creating a game, the game has a menu, each page in the game ...
0
votes
2answers
68 views

Canvas slowly degrades in performance after a while

I was creating a simple game and was shocked to see how the performance started to degrade. It never happened to me before, most probably because I use images and not the context drawings. So I used ...
0
votes
0answers
31 views

How to fix my physics functions so they perform at the same speed across different FPS's

My jump function looks like - self.jump = function(){ //do the initial jump if (self.pressingUp && self.onGround) { //this just gets it off the ...
0
votes
1answer
37 views

Fastest way to render isometric world with moving entities?

I've got an isometric diamond-shaped world. The world consists of isometric planes like rooms. The walls and floors of the rooms and all obstacles and items in the rooms are isometric entities. So I ...
0
votes
1answer
20 views

Canvas/Paint Mechanic

I am currently working on an idea for a unity game app with a canvas mechanic. I understand I may have to use particles for the brush/paint f/x however I can not think of a way to add collision ...
0
votes
0answers
8 views

Clicking an entity with transformation

I am trying to understand how best to implement a click detection function in a 2d JavaScript game. I can demonstrate using a simple example of two square 'entities' which can be selected when ...
0
votes
2answers
90 views

How to improve my graphics on HTML5 canvas?

I am making my own army fighting simulator. Designer have made an 3D model with Blender and textured it, made animations. I have made sprites from that model and did programming. But the result is not ...
0
votes
1answer
37 views

Unity3d multiplayer canvas

so I am making multiplayer game and I stuck on one thing, I have blood overlay canvas in my scene(you know, in fps games if somebody shoots you your screen becomes red and this stuff), and when I ...
0
votes
0answers
14 views

Move ball through a direction angle in android canvas [duplicate]

I am building a simple game in android. I am successful in first step where I draw a ball in canvas in touch point. Now I am trying to move it from an initial point A (center) through the touch point ...
0
votes
1answer
421 views

How to draw small sprite bigger?

I have created an image with the resolution of 25px(width)*34px(height) (I know it's unusual, however it doesn't bother me now). The problem is that when I try to display it by creating a bitmap, it ...
0
votes
1answer
37 views

How to display a lot of small objects using WebGL?

Introduction The game scene contains a lot of 10x10 pixel elements: for 1980x1200 px. screen the number of elements on the scene can vary from 0 to 23760 (elements cannot intersect). The live ...
1
vote
1answer
154 views

Drawing/adding shape objects with the mouse on html canvas

I've started with the canvas paint tutorial from link which worked fine with a few problems that can be fixed later. I've been checking a lot of posts on drawing shapes on the canvas but they all use ...
3
votes
1answer
359 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
0answers
33 views

Chrome Canvas bug on Mac OS X when switching spaces?

I have a simple Breakout clone created using the <canvas> element and the 2d context. Whilst playing the game in Google Chrome (version: 49.0.2623.87 (64-bit)) if I switch spaces within Mac OS ...
0
votes
0answers
69 views

Using canvas graphics instead of traditional sprites in phaser

I'm trying to learn Phaser (total beginner with mild JS experience) and I'm following tutorials and such where everything is using sprites. I'm trying to get by with basic canvas shapes instead of ...
0
votes
2answers
98 views

How can I move an object around a canvas in a random direction at random times?

I am currently trying to move an object (circle ball) around the canvas in a random direction. I have already written the code for the wall collisions so the ball bounces back into canvas when the ...
1
vote
1answer
66 views

How should I efficiently clear and redraw my canvas with lots of animated sprites?

My current solution is to clear the entire canvas and redraw all sprites on every requestFrame(). This works but feels inefficient: I only need to clear the part of the canvas made invalid by ...
1
vote
3answers
1k views

Where to start, to develop an online Backgammon game? [closed]

I would like to develop a backgammon game to play against other players online, as a way of learning more Javascript/jQuery and a little game development. I'm a web developer and most of my experience ...
0
votes
1answer
15 views

Mousedown event not performing drawImage

I've been working on the basic gameplay. I'm to a point where I think it should draw a card in the quadrant clicked/tapped, but nothing is happening. I can't see what's wrong. Please help. My only ...
0
votes
1answer
40 views

Why are my canvas drawings larger than the actual image?

For the following page source, I've finally gotten a grip on rendering the cards. I'm puzzled why they appear about 2.5x larger on the canvas. <html> <head> <style> ...
0
votes
1answer
30 views

HTML Canvas Makes Everything Bolder On Right Side

For some strange and sudden reason, my canvas seems to make lines thicker and darker on the right ~1/4-ish. I have tried multiple browsers and different computers and they all have the same rendering ...
1
vote
0answers
65 views

Drawing a hexgrid on a canvas, yet making it zoom/scrollable?

I'm developing a game in JS / PHP. The game is basically a 2D plane (hexgrid) where each hex represents a location in space. In total, I'm drawing 25 * 25 hexes on a 1000x1000 canvas. I also draw ...
0
votes
1answer
3k views

Alpha Value at 0 Shows Black for Android Canvas Bitmap

There have been a few questions similar to this but none seem to give a straight answer. If I am creating a Bitmap from a .png image and want to set a color (i.e. true pink) to transparent, the color ...
1
vote
1answer
25 views

how to follow(center) a box inside canvas element

If inside a canvas I draw a box, and the I add arrows to move it, the box will eventually be out of my reach since it goes out the border and I cant see it. How could I follow the box so that it is ...
7
votes
5answers
14k views

Huge performance difference when using drawImage with IMG vs CANVAS

I put together a couple of simple tests that render an image to a canvas. One renders from an IMG, while the other renders from an offscreen CANVAS. You can see the code and results here: ...
4
votes
1answer
115 views

Fixed Time Step Flutter

I've seen a lot of questions about this problem, but really no solution. Hopefully I can explain the issue well enough that I can get some sort of closure on this problem. I'm using a Fixed Time ...
4
votes
2answers
11k views

Is it possible to rotate an image on an HTML5 canvas, without rotating the whole canvas?

So I basically want to rotate single sprites on the canvas without rotating the whole canvas, is that someway possible. I also don't want to create a new canvas for each object I have. Also, it ...
5
votes
2answers
105 views

Create.js CPU High load

I'm new in Create.js and I'm trying to make countdown progress bar. I have this simple code: var stage = new createjs.Stage("timerCanvas"); stage.canvas.width = ...
0
votes
0answers
62 views

How to get the angle an object is travelling at

I'm trying to figure out how to get the angle an object is moving at, but have ran into a few problems. My player object is moved by rotating the entity left and right by using the left and right ...
3
votes
0answers
58 views

Check if a point is touching a user drawn curve in HTML5 canvas

I am having trouble detecting whether a ball is colliding with a red curve. The curve below is an example of what a user may draw on to the canvas. I can't think of any fast ways to detect collision ...
2
votes
0answers
34 views

Best practice/way for client to speak with server

I'm making a multiplayer game in HTML5 Canvas and Node using Express and Socket.io. It's a platformer style game and so far the players are able to see each other and move around on the screen. It ...
1
vote
1answer
48 views

Javascript canvas check if all recs on the screen overlap a new one

So I know the AABB collision detection formula, however, this code does not work. Whenever I press space, a new square pops up. But this new square can spawn inside another, something that I do not ...
1
vote
0answers
37 views

Facebook Canvas (web) Game for Desktop & Mobile Browsers

as the title suggests - I am about to develop a game for FB canvas. Will the game support mobile and desktop or do I have to create two different project/game setups for this? thanks
1
vote
1answer
126 views

How do I check if one square is overlapping another in HTML5 canvas

I have a little program that goes like this: Whenever somebody presses space, a blue square appears. The blue square shouldn't overlap with any other blue square. But the function that is checking ...
1
vote
1answer
234 views

Android canvas.drawColor throws a null object reference

I have two nearly identical methods, the first to draw a splash screen while assets are loading, and the second to draw all of the assets to the screen. The first throws a NullPointerException on ...
6
votes
4answers
380 views

Rotating sprite around another sprite

I am building a pool game, and I want to make the cue rotate around the white ball. Here is the live code: http://199.26.84.223/nocol.html Here is the code for the white ball: balls = ...
1
vote
1answer
453 views

Building a simple bomberman game with Node.js and Socket.io [closed]

I'm building this game mostly because I want to experiment with Node.js and Socket.io, and the game is more like a proof of concept. To start with, I have a 2D grid system as the game map. ...
0
votes
1answer
48 views

What determines the hit detection ordering for graphic elements in Unity (2d game)?

I have a bunch of overlapping buttons spread across several UI Canvases. The default mouse behaviour only registers hover/click events with one of the overlapping buttons, which is ideal for my ...
2
votes
3answers
2k views

HTML5 clicking objects in canvas

I have a function in my JS that gets the user's mouse click on the canvas. Now lets say I have a random shape on my canvas (really its a PNG image which is rectangular) but i don't want to include ...
0
votes
2answers
677 views

Tile Map Coordinates

I am have now this code: http://jsfiddle.net/DK67k/2/ In here is 2D tile map and when you click on tile you get coordinates on alert. But for get precises coordinate you need click on top left ...
0
votes
2answers
315 views

“Painting” elements in html5 canvas

I'm making a game in coffeescript (although for the sake of this problem that's probably not all that relevant) and html5's canvas. It's a game that involves a paint cannon, that fires circular ...
0
votes
1answer
2k 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 ...
0
votes
0answers
24 views

Performance slows down on click event

I'm currently working on a game in node using socket.io and drawing onto canvas. I'm noticing that when I click during the game, character movement slows to a crawl. For context: I'm updating x,y ...
2
votes
0answers
80 views

tilting image for mode7 game in HTML5

I'm making a mode7 game like mario-kart and I need to tilt the image before I draw it, I have tried using a buffer canvas to tilt the image then draw it on the games canvas but this makes it laggy ...
0
votes
2answers
11k views

How To Scale Canvas In Android

I am writing a android game using Canvas as the way to draw everything, the problem is that when i run it on different android phones the canvas dosn't change size i tried using canvas.scale() but ...
1
vote
3answers
1k views

Why does a UI button that is child to a canvas not appear in game view?

I am trying to place a button onto a canvas background using C# script. I want the button specific to the canvas (i.e., if I move the camera to look at another canvas, I do not want the button ...
6
votes
4answers
5k views

2D Collision in Canvas - Balls Overlapping When Velocity is High

I am doing a simple experiment in canvas using Javascript in which some balls will be thrown on the screen with some initial velocity and then they will bounce on colliding with each other or with the ...
2
votes
1answer
548 views

JS Canvas - Creating 2D Game lighting effect like Terraria

I just started working with canvas in HTML5 and with javascript. I'm pretty satisfied with my game so far: http://xenopal.dk/game-v1.1/. But I'd like to implement lighting as well in the style of ...
5
votes
3answers
507 views

How to do a genetic algorithm's chromosome which controls movements

First I would like to inform you that I'm french and 15 so my english is not very good. I've read some articles about genetic algorithms (GA) and since I discovered the HTML5's canvas element, I can ...