Search the Community

Showing results for tags 'sprites'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 192 results

  1. Hello all! I have a sprite with some children, 3 sprites and a text. The text floats above the sprite and moves with it. I have 4 layers that in my map and the sprite is rendered after layer 2. The problem is that the text ends up behind part of the map that sits in layers 3 and 4. Is there a way to force the text to the top of everything?
  2. I looked at the documentation on how to create a sprite https://phaser.io/docs/2.6.2/Phaser.GameObjectFactory.html#sprite It takes in the following parameters x y key frame group It's very easy to add a sprite with just the first three parameters car1 = this.game.add.sprite(800, 400, 'car'); But it fails when I try to add the car to a group car1 = this.game.add.sprite(800, 400, 'car', objects); If I went with the first declaration and then added objects.add(car1) it will then work I need to use the second declaration because my codebase is becoming way too large, and I need fewer lines. Not sure, why this is failing. Maybe an update killed this functionality?
  3. Hello, I am creating a game with Phaser and I guess it is quite large, at least there are a lot of sprites. Using Phaser.AUTO which went to Phaser.WebGL on my desktop (i7-4770k @ 4ghz, 16gb RAM, GTX 970 4GB) I can't even maintain a 60fps (usually around 48-55fps) and there is noticeable stutter on 720p. The same is true for my 2015 Macbook Pro 15". I doubt I'd get any better results on a less powerful computer. I heard that using text with WebGL slowed it down a bunch? but that is a question for a different thread I guess. Anyway, I was searching for a way to speed up my game and came across the idea of switching from WebGL to Canvas. I did that, and on my Mac I got a solid 60fps (haven't tested on desktop yet). The only problem is that Canvas does something weird to some of my sprites (specifically ones with thin borders). I have attached two partial screenshots of my game with box sprites. As you can see, one of the box sprites is perfectly box-like, that one is running on WebGL. Once I switch over to Canvas the box sprites look like the other screenshot - lopsided. Is there a way I can fix this?
  4. Hi all, I have a problem with collision. All my game is based on these codes: game.physics.arcade.collide(bullets, chest2,collision_handler); And it works. But... how to code collision two identical bullets? When I write like this: game.physics.arcade.collide(ebullets, ebullets, collision_handler); Only one of them is dying. How to do it? function collision_handler (object1, object2) { object1.kill(); object2.kill(); }
  5. Can someone tell me, please, why collision does not take place during animation? Here is a game : https://oobarbazanoo.github.io/JumperKisame/.
  6. Hi All i was wondering if someone could help me with a phaser state query. I have been learning phaser from phaser.io and its all for a html index file however the code seems to be different then to what i need if i was to build a game with states. For example i have a player walking animation but converting it for js states seems to be very difficult, i cannot find a tutorial anywhere. Any chance someone could point me in the right direction? happy to share the code Thanks
  7. 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.
  8. Okay so I have a rectangle boundary and I have 4 circles. Each of which I want to collide within this boundary. Is there a way to collide each sprite within this boundary without using p2? var rectangleBoundary = new Phaser.Rectangle(0, 120, 900, 1800); var c1 = game.add.sprite(200, 350, 'qcircle'); var c2 = game.add.sprite(500, 190, 'qcircle'); var c3 = game.add.sprite(120, 30, 'qcircle'); var c4 = game.add.sprite(590, 120, 'qcircle');
  9. Hello all, I am new here and playing with Pixi.js using latest build but learning with old tutorials and examples. My question is I am working on a Board Game: Jackpot game Problem: I want to generate 3 Random Sprite images on canvas but how to do that. I tried but it's not working, how to pass random fruit image into sprite and display it on canvas. Thanks in Advance. PIXI.loader .add("images/48.png", "images/49.png", "images/50.png", "images/52.png") .load(setup); function setup() { var randomFruits = ["images/48.png", "images/49.png", "images/50.png", "images/52.png"]; function getRandomFruit(fruits) { var num = Math.floor(Math.random() * fruits.length); if (num === 0) { num = 1; } var fruit = fruits[num]; console.log(fruit); } getRandomFruit(randomFruits); let orange = new PIXI.Sprite.fromImage(fruit); orange.scale.set(0.6); orange.x = (app.renderer.width / 2) + 230; orange.y = (app.renderer.height - container.height) / 2 + 20; app.stage.addChild(orange); }
  10. Hi guys may I ask a quick question? I'm working with Phaser and I'm using the module pattern, creating a module that has a prototype of Object.create(Phaser.Sprite.prototype) and creating an instance of that in the main module. The problem is the sprite seems to be created in the main module in the create function but the image of the sprite is not loading and i cant find the problem or set the image. Thanks so much!!
  11. I am having a really weird issue. I am creating a sprite from an image as follows: var grid1_texture = new PIXI.Texture.fromImage("whiteSquare.jpg"); Now this works fine and I am able to add this to the stage. I basically want to add all my images to a folder called resources. So I changed the code to this: var grid1_texture = new PIXI.Texture.fromImage("/resources/whiteSquare.jpg"); When I do this, I can see in Brackets editor that the link is being made however, the sprites do not get rendered on the stage. Please help!
  12. Hi, I implemented a two finger zoom using the game.camera.scale propierty to zoom the game. I also implemented a drag functionality using game.camera.x and game.camera.y propierties. But now I need to add static floating sprites, such that they are always in the same position on the screen regardless the zoom or the drag movement. But when I add them as sprites (game.add.sprite) they are affected by the camera propierties (x,y,scale). I read this and set fixedToCamera to true, it works partially, the (x,y) is static, but the when I zoom in (increase game.camera.scale) the size of the floating sprites also increases. Is there any way I could add sprites that are not dependent on the camera? Thanks!
  13. Hi, is it possible to make a sprite visible through the walls/meshes/other Sprites? Is it possible to make it visible always? PlayGround: http://www.babylonjs-playground.com/#1MJ5GH Its important because if the player is behind something he have to be visible. Also aims/marks in a labyrinth should be visible always. Thank
  14. Is there any way to add a listener that triggers when a sprite is visible by the camera?. The object Sprite contains inCamera, but it seems to re compute the bounds of the sprite according to this: http://www.html5gamedevs.com/topic/8936-does-phaser-handle-object-visibility-according-to-camera/, and that can be expensive. In my case I need to do this for many sprites on the screen, so I want to know if there is a more efficient way to do it.
  15. Edit: The solution to get Sprite2D with transparent areas working is to set "hasAlpha" on the Texture to "true". --- Hi, I want to use sprites2d (in canvas2d) made from png files that have transparent areas. expected behavior: Transparent areas are rendered transparent actual behavior: transparent areas are rendered not transparent It gets super weird, if I set opacity on the sprite to 0.999 everything works fine. Working, with opacity 0.999 http://www.babylonjs-playground.com/#DSJDT#11 no longer working with opacity 1.0 (or opacity removed): http://www.babylonjs-playground.com/#DSJDT#12 I will use the 0.99 opacity workaround for now., but this seems buggy - I would like my sprite to be rendered according to the alpha channel, and it's weird that this only seems to happen if I set opacity to 0.99. Maybe I missed another property?
  16. Hi, I have an idea of a game in which there would be a player who could collect different items(boots, helmet, pants, etc) It would really be a pain if I had to draw: 10 animation frames for normal character, 10 animation frames for character in boots, 10 animation frames for character in pants, 10 animation frames for character in pants,in boots, And so on..... You got me..(Of no, think of Minecraft or Terraria or Starbound where you can wear armor and stuff) So, my question is - Is it possible(in Phaser) to take different images(One for body, one for head, one for legs) and put them together and move,animate as if it was one image... Or maybe you have other suggestions?
  17. I am working on a project in which the user creates a system of points by adding them one-at-a-time. These points are also draggable, and clicking on existing points sets the clicked point as active. That's all working fine. When using a simple mouseDownCallback, clicking one of these existing points creates interference between the activities of the new point and the old point. I want to be able to determine what sprites, if any, a clicked point contains and run a function only if the spot is unoccupied. If I can do this via the activePointer versus specifically mouse, that's preferred, but not necessary. Can someone point me in the correct direction?
  18. I have an issue where I've got a row of rectangular sprites, drawn with phaser graphics, sitting in a seamless row. I then have some circle sprites set to move with set velocity in any of four directions (200x200, 200x-200, -200x200 or -200x-200) and bounce off this row of rectangular sprites. However, and this is behavior I've noticed before in a similar situation, whenever a circle sprite hits a rectangular one directly on the corner, the velocity drops drastically and it's direction changes substantially. Any clue on why this particular behavior occurs and any steps I can take in fixing it?
  19. tl;dr when I move parent, child position is updated too late, how to manually force to update child position when I move parent? Hello, in my game I have a group of sprite objects (Ships) this.shipsGroup = game.add.group(); Each Ship before adding to this.shipsGroup have two other groups as children : var actualShip = game.add.group(); var surrounding = game.add.group(); for (var m = 0; m < 3; m++) { var temp = game.add.sprite(-halfSize - 50 + l*50, tempy, 'red'); temp.anchor.setTo(0,1); tempy+=50; if(m == 1 && l > 0 && l < ship.unitSize+1) { actualShip.add(temp); } else { surrounding.add(temp); } } ship.addChild(actualShip); ship.addChild(surrounding); this.shipsGroup.add(ship); Note: every child object has position relative to parent (so child position (0,0) is on parent) Everything is fine up to this point. I'm moving my ships using something like that in every possible direction (I'm moving them on 50x50grid). This check is in update method of game. if(this.draggedShip.position.x - game.input.mousePointer.x >= 50 && some_boundary_condition) { this.draggedShip.position.x-=50; this.checkOverlap(); } So, after my ship has moved to next grid, I'm calling checkOverlap function to check on top of which grid fields actually is the ship. (I have seperate group of sprites for each grid field) checkOverlap: function() { for (var i = 0; i < this.draggedShip.children[0].length; i++) { for(var j = 0; j < this.fieldsGroup.children.length; j++) { if(this.draggedShip.children[0].children[i].overlap(this.fieldsGroup.children[j])) { this.fieldsGroup.children[j].alpha = 1; } } } }, What is wrong : it looks like sprite.overlap uses OLD children positions (before parent move). So when I move my ship 1 field to the left, the result of this checkOverlap function are fields where the ship was in previous step. How it should be: children positions should be updated before my checkOverlap call. How can I force to do it? I was trying to call update on childrens but it didn't work. Phaser 2.6.2
  20. Hi, I'm new to Pixi.js and I'm trying to make a simple scene, in RPGMaker Style (with different tiles on the ground to draw the scene). I coded a little app that simply creates all the needed sprites, adds them to a Container (or ParticleContainer, tested both), adds the whole container to the scene, and manages a few keyboard inputs. The result is highly laggy... What am I doing wrong? I would happily look for other ways to do this but I think I'm doing what guides show, so I don't get it. Here is the code : http://pastebin.com/C9UUK8nL Thanks !
  21. Hi guys Recently I'm testing my game on iphone7, I found out that the phone heat up very soon even though I have not started playing it, so basically there are just around 30 static sprites. When I reduced the number to less than 10, the temperature drop obviously. Eventually, this problem is resolved by changing the renderer from Phaser.AUTO to Phaser.CANVAS, but I don't understand why the canvas perform better than webgl, and why it only happens to iphone7(on iphone6+ or 7+ are totally fine), has anyone had the same problem can explain it to me?
  22. I've got a wee game where I've created a group of circles and a group of rectangles (they're called slots in the code) which are placed randomly on the canvas. The circles move around the world pseudo-randomly and when they intersect with a slot, the text at the top of the screen should change. However, I'm struggling to 'traverse' the groups properly: my function only checks one specific circle against one specific slot. I'm still pretty new to Phaser, and this 'game' is cobbled together from various examples so I'm sorry if it doesn't make much sense. Here's the sandbox: https://phaser.io/sandbox/edit/EilDwRdH And here's the markup of the specific functions I'm using to check intersection: function update() { circles.forEach(function(c_circle) { slots.forEach(function(c_slot) { if (checkOverlap(c_circle, c_slot)) { text.text = 'Overlapping: true'; } else { text.text = 'Overlapping: false'; } }); }); } function checkOverlap(spriteA, spriteB) { var boundsA = spriteA.getBounds(); var boundsB = spriteB.getBounds(); return Phaser.Rectangle.intersects(spriteA, boundsB); }
  23. Here's my situation: When the main game state starts, it generates a couple hundred objects (sprites, images, etc) scattered around the world, but when I change to a different state, the objects are removed as normal, and when I change states back to the main state, the objects are re-generated. I'm trying to figure out a way to not re-generate that large number of already-generated objects when I switch back to the main state. I already know that game.state.start() gives you the option to not clear the world, but this keeps the objects from the previous state displayed. Is there a way to store those objects so they don't appear when the state changes and then reappear on the screen where they were when the state is set back to the first state? More details: I'm making an AR mobile game that uses random seeds based on the current geolocation and time (rounded to minutes) to generate objects with limited lifetimes. I'm trying to make it so that objects that are close to being destroyed still appear even though re-generating the objects would not generate them. For example, an object was generated 5 minutes ago and will die in 2 minutes. The state changes and the player does stuff in that state then goes back. The object still should have 1 minute left before it disappears but it is already gone because time has moved forward to the point where it would not generate the object again. I'd like that object to remain and live out that last minute of its life since it was there before the player changed states and should be there when they get back.
  24. 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); sprite.boundsPadding = 0; sprite.drawCircle(50, 50, 100, 100); } function create() { game.physics.startSystem(Phaser.Physics.ARCADE); aliens = game.add.group(); aliens.enableBody = true; for (var i = 0; i < 10; i++) { var s = aliens.create(game.world.randomX, game.world.randomY, sprite); s.name = 'alien' + s; s.body.collideWorldBounds = true; s.body.bounce.setTo(0.8, 0.8); s.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40); } }
  25. Hi!, I'm new to Phaser, I just started a day ago and it looked pretty interesting, But lately I've been having some problems with certain sprites that will break the game if I try to add them as an animation (will go into a black screen as soon as starting), and if i try to stop all animations and start the game with no animations, trying to see the sprite at least frozen, the game will just show any other sprite on the list avoiding the 'broken' sprite. I'm using a JsonHash from TexturePacker (the trial version) "walk/07": { "frame": {"x":113,"y":2,"w":38,"h":48}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":38,"h":48}, "sourceSize": {"w":38,"h":48} }, "walk/08": { "frame": {"x":112,"y":110,"w":39,"h":46}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":39,"h":46}, "sourceSize": {"w":39,"h":46} }, "batk/01": { "frame": {"x":2,"y":54,"w":39,"h":52}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":39,"h":52}, "sourceSize": {"w":39,"h":52} }, "batk/02": { "frame": {"x":43,"y":165,"w":33,"h":51}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":33,"h":51}, "sourceSize": {"w":33,"h":51} }, "batk/03": { "frame": {"x":2,"y":2,"w":64,"h":49}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":64,"h":49}, "sourceSize": {"w":64,"h":49} }, "batk/04": { "frame": {"x":69,"y":2,"w":41,"h":49}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":41,"h":49}, "sourceSize": {"w":41,"h":49} }, "batk/05": { "frame": {"x":77,"y":110,"w":32,"h":52}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":32,"h":52}, "sourceSize": {"w":32,"h":52} }, Here's part of the Json, the sprites that wont work are the "batk/**". And the meta "meta": { "app": "http://www.codeandweb.com/texturepacker", "version": "1.0", "image": "Kenshin.png", "format": "RGBA8888", "size": {"w":237,"h":218}, "scale": "1", "smartupdate": "$TexturePacker:SmartUpdate:5c2cc8f899f401916073813f8a57c05c:859f44caf8d84d1347ca0147886ae398:b98d3e23e0675afb80a9fc68a5d2d511$" } I remade the Json and the png and still the same sprites won't work. KenshinChar = game.add.sprite(36, game.world.height - 120, 'Kenshin', 'batk/03'); Tried to start the game with a bg and basically just one of the sprites, without animation and it avoided the sprite showing the first sprite of the Json. Here's the whole png. and these are the ones that won't work. I'm just trying the framework so I borrowed some sprites from a certain ds game. I have absolutely no idea what's happening, sorry if it's something dumb I'm missing.