Tag Info

New answers tagged

1

You don't use cookies. Take a look at localstorage. It is intended for storing small bits if data, that is too big for a cookie. Here is more info: http://www.html5rocks.com/en/tutorials/offline/storage/


0

I would create a bytecode interpreter for this, see: http://gameprogrammingpatterns.com/bytecode.html for a lot of details. Keep in mind that the bytecode is an example, but you can easily write something similar on your own using more readable instructions. The basic idea is the same though. So you write a bunch of small programs for each card effect. Then ...


0

I finally found the solution! Draw the enemies with respect to the map's position! Just draw the map, and then the entities on top of it a certain distance away from the map's top-left corner. This way, no matter how the map's position changes, the entities will stay put because they're drawn based on where the map is. The player is drawn on top of ...


0

One way to solve this, is by parenting the object to the camera, when the object receives the OnMouseDown signal. This could look similar to this: function OnMouseDown() { Camera.main.transform.parent = this.transform; // Optionally, set some flag and smoothly move towards a Vector, same with the size Camera.main.transform.position = ...


1

Jordan replied the question properly, I have given here some resource that might be helpful. using state in Phaser github template for phaser game in-phaser-how-should-i-be-managing-state


0

Try fixing parenthesis: var pitch = Math.atan((v*v+Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/(g*x)); var pitch2 = Math.atan((v*v-Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/(g*x)); Consider also using atan2 function. Maybe in your case it won't fix anything but it's always good to know about it. https://en.wikipedia.org/wiki/Atan2


0

Your constrain function seems to be flipped. You call m.constrain(p); which is going to call: // stops 'obj' from leaving 'this' (except that you shouldn't be setting variables of *this*) this.constrain = function(obj) { if(this.x > obj.x) { this.x = obj.x;} if(this.y > obj.y) { this.y = obj.y;} if(this.x + this.width ...


1

setInterval runs forever, or until you cancel it. This will be a "fire and forget" call. You don't need the loop. The code will run forever, once every few milliseconds. setInterval(function() { // move it up if its too small if (copper < max) { copper++; document.getElementById('GC').innerHTML = copper; // move it down if ...


0

Maybe you forgot to preload the tileset image? Besides preloading "res/farm.tmx", you may have to preload, say, "res/farm.png". I had the same problem, and that solved it for me.


0

You basically found out about transforms and spaces in 2D! If you enter this "new missile space" via translation followed by a rotation then you have to do the same thing in reverse, multiplied by -1. missile.rotate(-30 * TO_RADIANS); missile.translate(-30, -20); Now your missile is in "world space".


0

Almost too many questions in one post, and a little too non-specific for stackoverflow, but I'll try to answer as best as I can: As you've correctly discerned, you'll at least need a node.js server for the wars. Additionally, that node.js server might profit from not having to do anything other than wars. In other words: Even if you choose to use nodejs ...


0

Disclaimer. My first intention was to update existing answer, but then I understood that I totally rewrote it. That's why I am creating new one. Yes, it's possible. The communication is possible between the browser and unity in both directions. In the unity documentation this topic is well described. So it's possible to create a general function that will ...



Top 50 recent answers are included