Search the Community

Showing results for tags 'enemies'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 10 results

  1. Santiago

    Group of enemies don't take damage

    Hello! I have a group of enemies following the player, and I want when they are overlapping with the player and I press Q they take an amount of damage setted before. this is the part of the create function where I create the group this.enemies =; this.enemies.enableBody = true; this.enemies.setAll('body.immovable', true); this.enemies.createMultiple(5,"vikingo") this.enemies.children[0,1,2,3,4].health = 100; console.log(this.enemies.children[0,1,2,3,4].health) Here's the function I'm trying to use. Before I used the same syntax with a single sprite and went perfectly. In this case the console throws "Uncaught ReferenceError: i is not defined" matar: function(){ if(this.player.scale.x == 1 && this.Q.justDown && game.physics.arcade.overlap(this.player, this.enemies)) { this.enemies.children[i].damage(25); game.physics.arcade.moveToXY(this.enemies.children[i],15,2500,-300,0) console.log(this.enemies.children[i].health) } if(this.player.scale.x == -1 && this.Q.justDown && game.physics.arcade.overlap(this.player, this.enemies)){ this.enemies.children[i].damage(25); game.physics.arcade.moveToXY(this.enemies.children[i],-15,-2500,300,0) console.log(this.enemies.children[i].health) } }, I tested some other ways like changing children with children[0,1,2,3,4] but instead of throwing error I get "health = 100" all the time.
  2. NikoFenix


    Hello how are you, I'm developing a rpg game and I'm in the development of enemies, in short my problem I have an enemy (spider) that is dedicated to securing the player, but I can only ahcer follow the mouse, some solution ? My code is PRELOAD < game.load.image('ball', 'Multimedia/Imagenes/Personajes/spider.png'); > CREATE game.physics.startSystem(Phaser.Physics.ARCADE); balls =; balls.enableBody = true; for (var i = 0; i < 50; i++) { var ball = balls.create(,, 'ball'); } ------------ HERE IS THE PROBLEM --------------- UPDATE if (w.isDown || a.isDown || s.isDown || d.isDown) { // First is the callback // Second is the context in which the callback runs, in this case game.physics.arcade // Third is the parameter the callback expects - it is always sent the Group child as the first parameter balls.forEach(game.physics.arcade.moveToPointer, game.physics.arcade, true, 200); } else { balls.setAll('body.velocity.x'); balls.setAll('body.velocity.y'); }
  3. First, let me introduce myself, I'm a web developer since a few years ago, this year in particular my work started to get tedious and boring so I decided on my spare time to try something new (game development), and while searching for options I stumbled upon Phaser. Since I'm familiar with HTML5 and Javascript I'm advancing at a fast pace, I already made some tutorials and small simple games, but as my current challenge I decided go forth and make an clone of a NES game. My game is a standard 2D plataform game were you control a ninja. Currently have my player class working (using a sprite atlas, with all the controls that I need), my level using tiles (using tiled as a level editor), and now I started to work on enemies. In my previous games the enemies were simple (if the player hit them, they simply dissipated, so it was a simply collision test against the enemy group). The thing is, in this game the enemies are a little bit more complex: they patrol and they stay on a platform, they can "fall" into lesser platforms (based on certain conditions) and they can fire at the player if he's in range. I haven't actually started programming them yet (just a generic enemy class), Looking for answers I found an image (IMPORTANT: NOT FROM MY GAME) that can help me out convey what I'm trying to do: Let's assume I want to add an enemy like this. This enemy has a small collision box (the blue box in the center), two sensors (blue at the bottom) for detecting if the floor is there, and two (red) sensors to determine the patrol distance (and if the player is in range, triggering the attack), I want to implement this but I'm not sure if this is even possible on phaser. So my question are: - How can I add sensor on phaser (its this approach even possible?) - What physic system I must adhere to make this work (currently using ARCADE physics)? - its a good idea to have all those sensors on a single sprite or the memory will explode and the game will lag? - There's a "good way" or a standard practice to write enemies/behavior? Any help on how to tackle this issue will be greatly appreciated! and thanks in advance
  4. I am having a problem that I want all the enemies doing the enemyColidiuTile function but just one or two of them do. How can i fix that play = function (game) { };var points = 0;var pontost;var ganhou = 0play.prototype = { create: function () { game.physics.startSystem(Phaser.Physics.ARCADE); game.physics.arcade.gravity.y = 0; game.physics.arcade.gravity.y = 100; map = game.add.tilemap('mapa'); map.addTilesetImage('chao', 'tilesCenario'); map.setCollisionBetween(1,6); map.setCollisionBetween(9,11); layer = map.createLayer('cenario'); layer.resizeWorld(); enemies =; enemies.enableBody = true; map.createFromObjects('camadaInimigos', 22, 'inimigo', 0, true, false, enemies); }, update: function () { game.physics.arcade.collide(enemies, layer,this.enemyColidiuTile,null, this); },enemyColidiuTile: function(enemy,cenario){ if (points == 0 ){ enemy.body.velocity.x -= 100; } if (enemy.body.blocked.left){ console.log("esquerda") enemy.body.velocity.x += 100; } if (enemy.body.blocked.right){ console.log("direita") enemy.body.velocity.x -= 100; }}, };
  5. My team is having a little debate on whether or not to show enemies health (in a bar, with or without numbers). We're split about 50/50 so I thought I'd bring the question up here. In a casual game where it's my 1-3 guys vs 1-3 enemies, you take turns attacking, and you attack by choosing an action and who that action is taken against, do you feel the need for an enemy health bar? Does showing health give any benefit? Does taking heath representations away lose any or gain any benefit? What are your thoughts on displaying health? Thanks!
  6. el_scrambone

    [WIP] Angry Submarine

    Description: Collect gems to earn money, avoid or KILL enemies, collect fuel and ammo, go as long as you can! Mobile friendly HTML5 game Author: el_scrambone Genre: Action, Adventure, Shooter Game Dimensions: 852 x 640 pixels Game Link: If you have some questions or tips - go and tell it to me) will be glad to get some feedbacks! Screenshots: Video Trailer:
  7. AI enemies do things from time to time, etc ... It is time in my game, I have to create enemies. I do not know how to deal with the issue, I would like you to tell me some options there. How to make the enemy walk to the left and to the right, jump from time to time, etc .... that sort of thing. Thanks!!
  8. Hello. I'm almost finishing my first game, but I'm stuck with the enemies issue... I want that the enemies comes from the upper part of the screen at random intervals but I can't do it. I was looking for tutorials but I don't know how to do it. I think that I need to create a group for the enemies and I did that already. Thank you so much in advance. Regards, Daniel.
  9. BenClarkson

    Multiple collision layers on a tileset

    Hi! I am working on a game with kids from the inner city in one of the most dangerous neighborhoods in Canada. I am trying to integrate multiple layers from tiles to control behavior of different sprite classes (like enemies) that have their own collision tiles separate from the player tiles. I cannot actually figure out how to make the physics system recognize any layer but the player's layer. I've been able to get around it before with some tile classes but now I feel I need the enemy to interact with the tilemap separately than the player. Below is some of my code. Please help! The children are waiting! map ='tiles'); map.addTilesetImage('tiletile') layer = map.createLayer('tiles'); this.enemyLayer = map.createLayer('enemyCollide'); this.enemyLayer.resizeWorld(); this.enemyLayer.debug = true; layer.resizeWorld(); map.setCollisionBetween(1,20); console.log(map.layers[2])
  10. So I just need some general advice and help on a game I'm making, first game I've made essentially been building on the same code through like 15 stages and since I'm new to html5 and javascript I've accrued a mass of errors and odd things in my code, but it "works". Here is my game thus far, it is called: Bellum Gerere My end goal is you the player have a healthbar (implies death, damage and survival) and you fight moving mesh objects, and after hitting them a couple times by shooting out a collision mesh on mouse click events the enemy dies and then you fight a boss. A larger mostly indestructible mesh with small vulnerable areas exposed in cycles. I want a very simplified version of Zone of The Enders 2 versus mode, or something like REZ, but more basic! simpler. I have some CSS errors, if someone could help with that... And sometimes some meshes aren't attached to the player as they should be. And yes, you're not supposed to be able to jump on all the meshes, but I'd like it so that you can't just go through them. SHORT TERM GOAL: setting a mesh to fire out out the player mesh and "hit" other meshes on mouse click. Let me know what you think, lag, glitches whatever, thanks.