Jump to content

Search the Community

Showing results for tags 'groups'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • 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





  1. Hi All Quick question, I am scratching my head on this for the last day - what am I doing wrong ? I have created a basic car driving on a highway and to avoid the cars. I hae created an enemies grou fornthe car and my car is a player object http://html5gamer.mobi/phaser2/carChase/index.html sample of script : in create I have : //player this.player = this.add.sprite(this.game.world.centerX, this.game.world.height - 200, 'player'); this.player.anchor.setTo(0.5); this.game.physics.arcade.enable(this.player); this.player.body.collideWorldBou
  2. I'm working on a dungeon/cave exploration game and created some torches to scatter throughout the gamespace to guide the player via a tutorial here: Game Mechanic Explorer Lighting. Got the lighting working wonderfully finally but when I try to animate the sprite linked to the torches nothing happens or it breaks the game. I've tried standard animation add and play calls along with the shown callAll animation.Both animations and callAll throws errors of cannot read property animations/callAll of undefined. Any thoughts as to why I can't get the torch to animate? Relevant code below (my g
  3. So I have a group, and it has three sprites. create() { var parent = game.add.group(); var allSprites = [ 'sprite1', 'sprite2', 'sprite3']; for (i=0; i<3; i++){ childImage = parent.create( game.world.centerX, game.world.centerY+ (i*30), allSprites); childImage.anchor.setTo(0.5, 1); childImage.inputEnabled = true; childImage.input.useHandCursor = true; } } How to I trigger function changeText(); when one of the child sprite is clicked. So far I have tried this method below but it only detects click on the
  4. Hello, As per title, can anyone explain the difference between Group / physicsGroup and use cases for each? Many thanks for your help, P
  5. Hello, I'm following an online tutorial and had a question regarding the code shown below. I was wondering what this.add(floorTile) does? I assume this is adding the floor tile sprites to a group? Note, I have removed much of the code for brevity. this.floorPool = this.add.group(); this.platformPool = this.add.group(); this.platform = new MrHop.Platform(this.game, this.floorPool, 12, 0, 200); this.platformPool.add(this.platform); MrHop.Platform.prototype.prepare = function(numTiles, x, y) { this.alive = true; var i = 0; while(i &
  6. I am looking at this Phaser example, and am simply trying to replace the aliens sprites with simple filled circles drawn by graphics - I've also removed the car, I just want some sprites moving around the area randomly. Unfortunately, the sprites appear with the "no image" graphic. I'm not sure what I am doing wrong here, any help is appreciated: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create }); var aliens; var sprite; function preload() { sprite = game.make.graphics(0,0); sprite.beginFill(0x00FFFF, 1); s
  7. Hi, i'm creating a gameover screen and i made it .. now i want color faded or like an overlay screen around gameover screen group. this is the code snippet i'm using ... this.gameOverScreenGroup = this.game.add.group(); this.gameOverScreenGroup.x = 197; this.gameOverScreenGroup.y = 52; /* var gameOverBGScreen = this.game.add.bitmapData(this.game.width,this.game.height); gameOverBGScreen.ctx.fillStyle = "#d5d2cc" gameOverBGScreen.ctx.fillRect(0,0,this.game.width,this.game.height) */ /* Game Over
  8. I'm relatively new to Phaser, but up until now I have found everything to work as expected. I'm trying to develop a Worms clone (just for fun) and i'm basing most of my code on the following tutorial :http://phaser.io/tutorials/coding-tips-001 The problem is, I can't get my worms (group) to collide with the land (bitmapdata converted into a sprite) Here is my create() create: function() { //create background first this.background = this.game.add.sprite(0,0,'background'); //start the physics system this.physics.startSystem(Phaser.Physic
  9. Hey! I'm struggling really hard trying to get anything to work - I checked to Playgrounds, forums and documentation but I can not find anything helpful about working with imported meshes. Am I blind? Most of the playground examples I can find work with simple meshes like cubes and spheres, but that is not helpful for me. var frame = new BABYLON.Mesh.CreateBox("box", 100, scene); frame.isVisible = false; var loader = new BABYLON.AssetsManager(scene); var meshTask = loader.addMeshTask("FW", "", "assets/", "groups.babylon"); meshTask.o
  10. Hello, this is my first time developing a game, ever. So please bear with me Currently I'm making a game where a player can shoot bullets at enemies. Each enemy has it's own healthbar, which should decrease when a bullet hits the enemy. For now, implemented the healthbars as a spritesheet with 5 different frames and added them as children to the enemies. function create() { enemies = game.add.group(); game.physics.arcade.enable(enemies); enemies.physicsBodyType = Phaser.Physics.ARCADE; enemies.enableBody = true; bars = game.add.group(); for (var i = 0; i < 5; i++) {
  11. I have a group of 6 elements and want them to do a specific tween separately with a delay between each. However, everything I've tries just seems to start them all together at once. var bulge = game.add.tween(tiles.getAt(i).scale).to({ x: 1.2, y: 1.2 }, 1000, Phaser.Easing.Back.InOut,false, 0, 1, true); Any help is appreciated
  12. I want to create game with unlimited world. I decided to make world wrap to move player and items to new position when player reaches end of world. wrapHorizontal() { let padding = game.width/2; let player = this.intoHell.player; if ( player.x + padding > game.world.width) { this.wrapped.x += 1; this.intoHell.player.x = padding; this.intoHell.background.sky.tilePosition.x += 2*padding; this.intoHell.items.x -= game.world.width - 2*padding; } else if ( player.x - padding < 0 )
  13. I think groups are not really possible with Box2D based on a post by Rich some where. Instead, I have made some text follow the player by setting it's x and y relative to the player's positions. It's look alright but has a floating appearance like the body moves away faster some of the time. Is there a way to get multiple sprite attached to a body without any floating?
  14. Hi I need to find the distance between a player sprite and the closest sprite to it in a group of sprites, I know this can be done by iterating through each of the sprites in the group and checking them individually however, I was hoping phaser had a built in way of accomplishing this. Once the player is within a certain distance, it will die so if phaser has an event for this that will work as well. Thanks for any help
  15. Hi, I need more rendering groups, is it possible? Cheers
  16. Is it possible to create a group and configure in such a way that any child with position (0, 0) would be the center of the group instead of its top left corner? As I add bigger sprites to the group and its size increases, things get misaligned. The manual solution seems to involve re-adjusting the positions of the object in the group every time I add/remove something to it, which is kinda ugly.
  17. So in my game the player object is made up of several different sprites, so I made a Group called "player," and tried to add an object to it, "rover_proto." I am also trying to use forEach() to change attributes of each item belonging to the group. Here is my code: function createGameScene() { // format: (game, name, addToStage, enableBody, physicsBodyType) player = game.add.group(game.world, 'player', true, true, Phaser.Physics.P2); Rover_proto = player.create(0, 0, 'Rover_proto'); //player.setAll('body', true, true, false); //Group collision player.forEachExists(functio
  18. I have a group of clouds and from what I understand groups work like sprite pools, but also their creation order specifies the render order in the scene. I have 4 groups that I use for layering : backgroundLayer playerLayer foregroundLayer UILayer I have a cloud group that has my clouds an it's currently a child of my backgroundLayer so the clouds get rendered behind the player. The issue is that is some situations I want to have clouds in foregroundLayer. what is the best way to handle this? 1---> Should I have two groups of clouds, o
  19. I been having an issue while looping through 2 groups and got this error, what I think this means is one of the objects is undefined. Uncaught TypeError: Cannot read property 'width' of undefined This is code (which is in Typescript) that causes the error: for (var i = this.tris.children.length - 1; i >= 0; i--) { for (var s = this.squares.children.length - 1; s >= 0; s--) { if(Overlap(this.tris.children[i],this.squares.children[s])){ this.BreakTris(this.tris.children[i]); this.BreakSquare(this.squares.children[s]); } } } The error is given specifically for the
  20. Hi, all I try to write game similar on: During development I have faced a problem how to place text above sprite for each element in group. At the moment I see only one solution, create for each letter personal group, but i think that it not the best decision. I have checked all documentation but haven't found anything similar. Thanks for any help.
  21. Hello, i'd like to know if there's any way to determine if a certain sprite is part of a certain group. More specifically, if i can check for collision between sprite and group, and make sure the sprite is colliding with another sprite that's part of a certain group. Thanks in advance.
  22. Hi, I have a problem with Ninja physics when I adding a group with sprite in my game. I read on this forum, that Ninja doesn't support group collision, but mayby something was changed withing the last year, because in my it work, but not that what I expected. http://codepen.io/DonWasyl/pen/BjEeBL What could be the cause this "bullet time" effect? Without group everything was ok. Can I use any trick for repair that?
  23. Hello, I encountered an error in "RenderingGroup.prototype.dispatch = function (subMesh)". This occured when I tried to activate shadows on a mesh. "material" is undefined in this case and produces an "needAlphaBlending of undefined" error.
  24. Hi All, I am trying develop a game that contains a color band of 5 different colored rectangles. So I created a group and added those rectangles to it(I have uploaded the image of the output). Now I am trying to write the code in such a way that the entire group will be moving horizontally once I drag it. But from what I found we can make the individual element in the group draggable but not the entire group. Anyways, I did write the code this way but I think its wrong as its not working. Here it is. var leftRectGroup = game.add.group(); var colorarray = ["0x607D8B", "0xFF5722", "0xFF
  25. Hey everyone, how do I create an array of groups? I've tried things similar to this.groupArray.push(this.add.group()); Thanks
  • Create New...