jar4563

Members
  • Content Count

    7
  • Joined

  • Last visited

  1. nvm that code was really bad, got it working
  2. @grelf Thanks for the link following the rotation example on that page I have this code now: ctx.save(); // right rectangles, rotate from rectangle center // draw blue rect ctx.fillStyle = '#0095DD'; ctx.fillRect(150, 30, 100, 100); ctx.translate(200, 80); // translate to rectangle center // x = x + 0.5 * width // y = y + 0.5 * height ctx.rotate((Math.PI / 180) * rotAngle); // rotate ctx.translate(-200, -80); // translate back ctx.restore(); // Draw some text: ctx.font = "30px Arial"; ctx.fillText("Pos: " + worldPos.x + " " + worldPos.y, 5, gameArea.canvas.height - 15); But nothing happens. only if I remove the save() and restore() the rect rotates as supposed to but then it also rotates the text's position that I'm also drawing What am I doing wrong?
  3. Hi I have been trying to figure out why javascript image rotation wont work. I'm testing the rotation demo in w3schools.com site but even that does not work. The more angle you put to the image the further it goes off from the screen. When it's supposed to rotate the rect from the middle the rect seems to orient 0,0 Here's link to the tutorial: https://www.w3schools.com/tags/canvas_rotate.asp Oh and that tutorial uses rect drawing but it's the same issued with drawImage() Any ideas why it doesn't work? I use google chrome thx!
  4. Actually I found there is browser version of the library so I'm using that. But if some one wants to shed some light on this topic anyway feel free to do so
  5. Hi I was looking for some javascript pathfinding libraries and wanted to use such for my game but I realize they use the require function and what I gathered is that it means the script can only be used in server (NodeJS). So, what are my best options if I want to use such libarary? I'm really a beginner to server side javascript and don't know what it takes to get that running thanks!
  6. @b10b Yeah, thanks. I googled for obfuscating and minimizing, those are the only tools I know
  7. Hi html/javascript being open source in the browser a question rises how to sell your game if anyone can just grab the code? Maybe php can be used to prevent this. Any advices for beginner are welcome thanks!