Tag Info

New answers tagged

0

As pixelmike mentioned, the problem might be that the keydown event executes every x milliseconds while the key is being pressed, and that is what produces the wrong player.facing value. Since you want the player to move in only one direction, the one of the last key pressed (and I guess that you set player.moving.x = false somewhere because the movement ...


2

One way to apply light effects with the Context2D is to use the composite operation 'lighter' (globalCompositeOperation='ligther'), and adjust the alpha (globalAlpha= 0.0 to 1.0). Then you can either : • Draw the shape of the light with several geometric drawings that create a simple shade to get a cartoonish light effect. • Define gradients to get a ...


0

I wasen't able to get the array working so I bypassed it and got it working by adding contextVar.strokeRect(filledCircle.x,filledCircle.y,filledCircle.w,filledCircle.h); to the addFilledCircleFunc. // to do: // add gameloop and draw with gameloop? // stroke line in resize fix // collission check + detection objects // functions to draw detection objects // ...


0

Honestly I think you are creating problems out of nowhere :) About the gamearea.generate function: If I understand what you are trying it do, shouldn't it return "canvas" so you have a way to reference it later. About the context function: You will only need one context. Read the answer of this question: ...



Top 50 recent answers are included