• Content count

  • Joined

  • Last visited

About jonteferm

  • Rank

Profile Information

  • Gender
  • Location

Recent Profile Visitors

325 profile views
  1. Don't you have the counter as a variable global to the whole game? Where do you keep the counter? Post a code snippet
  2. Cool! I played the demo and I love the style and atmosphere. Looking forward to the full game!
  3. You can set the size of the sprite body - if that is what you are after. sprite.body.setSize(width, height, offsetX, offsetY)
  4. Thanks! That works fine. Pretty obvious, but I did not think of it
  5. Hello, I have a problem with handling the collision between sprites. I have a group of enemies and a player sprite. I want none of the sprites to be able to move trough each others. At first I had the enemy body set to immovable and that disabled the player from pushing the enemy around upon collision. However, when I added more enemies to the group, I found that if the enemy bodies is set to immovable = true - they will be able to walk straight trough each others even if they have an internal collision detection (as that is the case between two immovable bodies). So if i set immovable to false - the enemies will appear solid when colliding with each other, but the player is able to push the enemy. What is it that I have not understood? I just want all the sprites solid.
  6. Hey! You can call this function on the tilemap: getTile(x, y, layer, nonNull). The X and Y should be given in tile units and not pixels, so for instance: if you have a 32x32 grid - tile unit 1 would be pixels 0-31 etc. You can see the full documentation here
  7. I don't know about the assets. I suppose it's free to use in your case but I let someone else answer that. But... Have you ever checked out this site? You might find some really cool stuff to use.
  8. Aah! Thank you Yes, that looks a bit weird in this context. It is a variable global to the game. I don't need to pass map to the function at this point - obviously as I do not even use it xD . But in the future - I thought maybe I will have more map objects representing levels and stuff which will load it's separate enemies. But now when I think of it: Why? I can't imagine I will ever have to view more than one map at once. Yes, you are right they should not be immovable. I guess I thought of "immovable" as "impassable". Also, when trying the line with the callback - I made the arcade.collide call in the wrong way. Thank you!
  9. Hey! I have a group of enemies created like this (called from create()): spawnEnemies: function(map){ this.enemies =; this.enemies.enableBody = true;; var enemyStartPositions = this.findObjectsByType('enemyStart',, 'objectLayer'); for(var i = 0; i < enemyStartPositions.length; i++){ var enemyStart = enemyStartPositions[i]; var enemy = new Enemy(, enemyStart.x, enemyStart.y, 'cultist'); enemy.countStats(); this.enemies.add(enemy); } this.enemies.setAll("body.immovable", true); } In the update function - I try to detect the collision between the children in the group like in this example (using 2.4.7): physics&f=group vs self.js&t=group vs self&phaser_version=v2.4.7&; But they wont collide with - just passing trough - each other. Also tried with adding a callback as when I let the player sprite collide with the enemy group like this:, this.enemies, this.collisionHandlerPlayerAndEnemy, null, this);, null, this.collisionHandlerEnemyAndEnemy); And the callback-function will not be called (may it be that this does not even work at all when the case is group to group?). I need someone elses eyes on this. No properties for enemy body is set outside these code blocks.
  10. One suggestion would be to set up a web server and host it in a machine at home. Of course that may require you to buy something to host from if you don't want to keep your home computer running 24/7. I host from my Raspberry Pi 3 Of course that has some limitations depending on what will be on your website.
  11. Awsome! Yes, this works just as fine in this case. I use to create backgroundLayer and blockLayer in tiled and set collision on the whole block layer (because everything is just walls). Then I have an object layer for doors, items, npc starting positions and stuff that is going to be interacted with. Though, the tiles in the object layer are only placeholders to which I - in Tiled - assign properties with the name of the sprite/sprites that I should use in phaser as most of the stuff in my object layer use sprite-sheets for animation.
  12. If you want to get a specific tile out of a layer though. You can call this on the tilemap: getTile(x, y, layer, nonNull) . But that will be a tile object and not a sprite. Yes maybe the createFromObjects will work. Maybe iterating trough the tilemap and call that for every tile as it requires the layer array index.
  13. Ah, I see what you mean. If you should be able to call the sprite body in that way - the sprite must be it's own sprite object like the player Unit you got. So if I were you - I would create the towers in the object layer in tiled.
  14. About the collision: you can specify a custom bounding box by calling sprite.body.setSize(width, height, offsetX, offsetY).
  15. Looks like the walls is just a layer and not a group with enabled arcade physics. It will not work with the arcade.collide as it is just for stuff that have arcade physics. Have you tried to set collissionBetween to more than that? I have to set it to at least 3000 in my game for collision to take place.