0
votes
0answers
33 views

Calculating co-ordinates of a line/ray that's increasing in height with a known slope/radians. Height increase is also known

basically in my game I'm firing a line. The line's anchor point is at the very bottom of it, and half of its width. When I fire the line, its rotation gets set to face where we want it to go. Then, ...
-1
votes
1answer
82 views

Code explanation

Can someone please explain whats going on in this code written by Paul Irish I did not understand the draw(). function draw() { var time = new Date().getTime() * 0.002; var x = Math.sin( ...
1
vote
2answers
71 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 ...
0
votes
1answer
41 views

What is the actual formula to find the vertices of an animation frame in using a BVH file?

I've read this tutorial and tried many formulas to build the skeleton. I am able to build it without the rotations, but those break everything. This, for example, is a simplified code for one of my ...
12
votes
3answers
580 views

How do I lerp between values that loop (such as hue or rotation)?

View Demo I'm trying to make the joint rotate smoothly around the center of the canvas, toward the angle of mouse pointer. What I have works, but I want it to animate the shortest distance possible ...
0
votes
0answers
49 views

HTML5 Canvas: Get rect coords after rotation (relative to screen)

update: function(delta) { for (var i = 0; i < this.bullets.length; i++) { this.bullets[i].velocity = this.bullets[i].speed * delta; this.bullets[i].contextX += ...
0
votes
0answers
36 views

Sprite rotation algorithm [duplicate]

I'm making a game where you have to plot a function to hit certain objectives. I already made the plotting function and the animation to display a tiny missile that travels above the function. My ...
0
votes
1answer
155 views

Isometric Movement in Javascript In the DOM

I am creating a game using Javascript. I am not using the HTML5 Canvas Element. The game requires both side view controlles, and Isometric controls, hence the movementMode variable. I have got the ...
1
vote
2answers
294 views

Bouncing off a circular Boundary with multiple balls?

I am making a game like this : Yellow Smiley has to escape from red smileys, when yellow smiley hits the boundary game is over, when red smileys hit the boundary they should bounce back with the ...
0
votes
0answers
225 views

JavaScript 3D space ship rotation

I am working with a fairly low-level JavaScript 3D API (not Three.js) which uses euler angles for rotation. In most cases, euler angles work quite well for doing things like aligning buildings, ...
0
votes
1answer
149 views

Rotate 2d sprite towards pointer

I'm using Crafty.js and am trying to point a sprite towards the mouse pointer. I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under ...
2
votes
1answer
150 views

How good do I have to be at Math to create a 3D game using three.js? [closed]

A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. ...
1
vote
3answers
98 views

Move from point a, to point b, and determine the accuracy

Let's say I have a circle at point a (0,0), and I wish to move it to point b (23,58), whatever, how can I accurately do this with a speed variation if I wanted. (I'm doing this in javascript). Every ...
6
votes
3answers
367 views

How can I change the acceleration of an object to arrive at a particular time?

I'm trying to write some code to change an acceleration factor so a ball will arrive at a destination in a desired time. The problem is I don't know time (t) but I do know I want it to arrive at (t - ...
1
vote
4answers
254 views

A formula for point calculation based on value A's proximity to value B

I am trying to find a formula to use for my rhythm game's scoring. Basically there is a Guide entity and a Live entity. You control the Live entity and have to match it as closely as possible to a ...
1
vote
1answer
128 views

Increase restitution (bounciness) of an object in a JavaScript formula

I'm going slightly around the houses on this one. I originally started a thread over on Stack Overflow about it but then it seemed to diverge into mathematics, with no joy from the SO community over ...
2
votes
2answers
381 views

How do I calculate consistent frame timings at 60fps?

I'm writing an HTML canvas game that uses requestAnimationFrame and therefore runs at 60fps, although this is more of a question about failing arithmetic than about JavaScript. If I measure the time ...
8
votes
4answers
3k views

Staggered Isometric Map: Calculate map coordinates for point on screen

I know there are already a lot of resources about this, but I haven't found one that matches my coordinate system and I'm having massive trouble adjusting any of those solutions to my needs. What I ...
15
votes
7answers
643 views

Do I need a Point and a Vector object? Or just using a Vector object to represent a Point is ok?

Structuring the components of an engine that I am developing along with a friend (learning purposes), I came to this doubt. Initially we had a Point constructor, like the following: var Point = ...
2
votes
2answers
3k views

Rotate sphere in Javascript / three.js while moving along x/z plane

I have a sphere/ball in three.js which I want to "roll" around on the x/z plane. For the z axis I could simply do this no matter what the current x and y rotation is: sphere.roll_z = ...
0
votes
2answers
891 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 ...
1
vote
1answer
275 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 ...
2
votes
1answer
400 views

Detect mouse click on a bezier curve's neighborhood

I'm developing a game in HTML5 and JavaScript using Canvas API for drawing graphics. I want to detect if the user has clicked on a bezier curve which has the line width of 20 pixels (something like ...
2
votes
2answers
270 views

how to transform child elements position into a world position

I'm making a 2d space game in Javascript with canvas. In this game there's a bunch of spaceships, positioned in world space, with turrets, positioned relative to their parent ships. These objects also ...
1
vote
1answer
265 views

Isometric Optimization in javascript

I'm having some issues with my optimization of my game. I have a simple tile map looped like this in my case the images are 64 by 64 pixels: for (i=0; i < 50; i++){ //horizontal for (j=0; ...
3
votes
1answer
167 views

Make an object slide around an obstacle

I have path areas set up in a game I'm making for canvas/html5 and have got it working to keep the player within these areas. I have a function isOut(boundary, x, y) that returns true if the point is ...
0
votes
2answers
613 views

Check if an object is facing another based on angles

I already have something that calculates the bearing angle to get one object to face another. You give it the positions and it returns the angle to get one to face the other. Now I need to figure out ...
1
vote
2answers
244 views

How can I center a circle around a point on an HTML canvas?

I've got a job to make an engine and light game for canvas in HTML5. I like the things I make to be centered on the x,y positions I give it, I don't know why, it just helps me think about them ...
7
votes
2answers
2k views

Is there a simple way to do true isometric projection with an HTML5 canvas?

Is there a simple way to get a true isometric projection with the HTML5 canvas element?
2
votes
2answers
555 views

Simple Math Multiplayer game - is Ajax sufficient?

I'm planning to create a simple math multiplayer game and I plan to just use Ajax for the server/client communication but I'm not sure if this is sufficient or if I need a socket server. The game ...
5
votes
2answers
916 views

Arrays for a heightmap tile-based map

I'm making a game that uses a map which have tiles, corners and borders. Here's a graphical representation: I've managed to store tiles and corners in memory but I'm having troubles to get ...
14
votes
8answers
7k views

How should I sort images in an isometric game so that they appear in the correct order?

This seems like a rather simple problem but I am having a lot of difficulty with it. What should I do to properly sort images in an isometric game? In a normal 2d top-down game one could use the ...