Tag Info

Hot answers tagged

2

You could just store a second image (or use the alpha channel of your image) to store a heat map (this also depends a bit on how you're drawing this, e.g. through a canvas). You just create some mapping and tint areas in their specific color (example): Left arm becomes red. Right arm becomes orange. Left leg becomes cyan. Right leg becomes blue. As an ...


2

Actually, i'm not sure how "browserquest" handles this. But in other 2D topdown-View games, you just have multiple layers of tiles. Mostly 2+. In this case, the bottom of the tree is on layer 2, which will be drawn second (first layer is the grass underneath), and the top of the tree is on layer n-1, which will be drawn last. So the drawing-order would be ...


1

You need to handle the player objects velocity vector i.e. it's speed and direction. You also need gravity as a constant downward acting force. Finally you also need to be able to detect if/when the object is standing on firm ground i.e. when they are able to jump (in this case it appears to be fairly straight forward matter of floor y = 0, i.e. if y==0 then ...


1

If you'd like your game board to appear sharp, with lines of 1px width, at different resolutions, then you may be better off drawing your game board in the SVG vector format, using a tool like Inkscape or Illustrator. SVG files do have a nominal pixel resolution, as defined by the viewBox attribute of the SVG tag. This makes calculation of the positions of ...


1

Your issue comes from the fact that your 'hex' canvas is hidden by your 'ground' canvas, and do not receive the mouse events. But in fact you don't care from which canvas the click event was raised : just have your mouse handling code hook the events of the top-most canvas, and use those coordinates. (I assume here that all canvases have the same size ...


1

Use the overload of the drawImage method of 2DContext that allows you to draw part of an image. MDN calls it slicing: drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) Given an image, this function takes the area of the source image specified by the rectangle whose top-left corner is (sx, sy) and whose width and height are sWidth and ...


1

I know this is gamedev not game playing, but the Kerbal Space Program wiki has all the math and then some. More importantly, it explains it quite nicely in "plain English" if you drill down. Here's the basic mathematics of how to get something into orbit: http://wiki.kerbalspaceprogram.com/wiki/Tutorial:_Basic_Orbiting_(Math) I apologize for not copying ...


1

I don't quite understand why you need to do this, but seems like a convoluted way to retrieve values. I assume that you need to retrieve both the value and the name of the variables in order to serialize and deserialize. I think it would be easier to make the variables non static and just handle them like usual (maybe you could use some kind of singleton ...


1

Don't be confused by calling this game tic-tac-toe, it is its own game, and might or might not be as easily solvable as tic-tac-toe. Your game is "player1 wins by a tic-tac-toe draw, player 2 wins by either a tic-tac-toe win or loss." (Or the converse). If you think about it, either this game is a win for the first player, or it's a win for the second ...


1

It's just Text.width. Text objects have most the same properties as Sprites, so you can set their anchor, rotate them, etc.


1

while zooming out, check if distance of red-dot and center of circle is more than circle's radius. (Lets call this distance, d) if so happened, move the circle in direction of V vector ( V = red-dot.position - circle.position`) for x unit. (x= d-circle's radius).



Only top voted, non community-wiki answers of a minimum length are eligible