Search the Community

Showing results for tags 'phaser'.



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 3,380 results

  1. Hello. I'm experiencing some issues with collision between sprites and tilemaps, and cannot figure out how to fix it. It used to work in 1.1.3, so I have clearly messed up something. You can see for yourself here: http://mandarinx.github.io/experiments/phaser.tilemap-vs-sprite.html Use WASD to move and click the mouse to shoot a wooden box. I have limited the shooting to only one box, so you have to reload the page to shoot again. It made it easier to track what's happening. I want the collision callback to fire when the sprite hits a wall so that I can kill the box. The callback only triggers when you shoot at the corner of a tile, and never when the box hits a wall perpendicular. I'm using Phaser 1.1.5. View source to see how I did it. Source code pasted here, in case you prefer that. Bullet = function(game) { Phaser.Sprite.call(this, game, -100, -100, 'stuff', 0); this.anchor.setTo(0.5, 0.5); this.outOfBoundsKill = true;};Bullet.prototype = Object.create(Phaser.Sprite.prototype);Bullet.prototype.constructor = Bullet;var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameContainer', {preload:preload, create:create, update:update, render:render});var map;var layer;var player;var cursors;var bullets;var w, a, s, d;var counter = 0;var fireRate = 100;var nextFire = 0;function preload() { var assets = { spritesheet: { player: ['players.png', 16, 16], bullets: ['bullets.png', 32, 32], stuff: ['jerom_eiyeron.png', 16, 16] }, tilemap: { map01: ['map02.json', null, Phaser.Tilemap.TILED_JSON] }, image: { dungeon: ['DF_Tilemap01.png'] } }; Object.keys(assets).forEach(function(type) { Object.keys(assets[type]).forEach(function(id) { game.load[type].apply(game.load, [id].concat(assets[type][id])); }); });}function create() { map = game.add.tilemap('map01'); map.addTilesetImage('DF_Tilemap01', 'dungeon'); map.setCollisionBetween(0, 15, true, 0); layer = map.createLayer('Walls'); layer.resizeWorld(); layer.debug = true; player = game.add.sprite(48, 48, 'player', 0); cursors = game.input.keyboard.createCursorKeys(); w = game.input.keyboard.addKey(Phaser.Keyboard.W); a = game.input.keyboard.addKey(Phaser.Keyboard.A); s = game.input.keyboard.addKey(Phaser.Keyboard.S); d = game.input.keyboard.addKey(Phaser.Keyboard.D); bullets = game.add.group(); bullets.add(new Bullet(game));}function update() { player.body.velocity.x = 0; player.body.velocity.y = 0; if (w.isDown) { player.body.velocity.y = -200; } else if (s.isDown) { player.body.velocity.y = 200; } if (a.isDown) { player.body.velocity.x = -200; } else if (d.isDown) { player.body.velocity.x = 200; } if (game.input.activePointer.isDown) { var bullet = bullets.getFirstDead(); if (bullet !== null) { fire(bullet); } else { bullet = bullets.getAt(0); bullet.kill(); bullet.revive(1); fire(bullet); } } game.physics.collide(player, layer); game.physics.collide(bullets, layer, bulletHitWalls);}function fire(bullet) { if (game.time.now > nextFire && bullets.countDead() > 0) { nextFire = game.time.now + fireRate; bullet.reset(player.x, player.y); var angle = game.physics.angleToPointer( bullet, game.input.activePointer); bullet.body.velocity.x = Math.cos(angle) * 300; bullet.body.velocity.y = Math.sin(angle) * 300; }}function bulletHitWalls(bullet, wall) { bullet.kill(); console.log('wall tile index',wall.tile.index);}function render() { game.debug.renderText('Active Bullets: ' + bullets.countLiving() + ' / ' + bullets.total, 32, 32);}
  2. Hi, I just want to mention my Flappy Bird inspired game Tubeyflaps (http://casarock.itch.io/tubeyflaps). I've made it using Phaser. It's far away from a master piece and mainly a proof of concept and proof of my grunt based phaserBoilerplate (https://github.com/appsbu-de/phaserBoilerplate). The whole game is MIT licensed and OpenSource. You can find it here: https://github.com/appsbu-de/tubeyflaps Cheers! Casarock
  3. Hey guys,Ive been working on making a level editor in unity and then storing the resultant transform information like scale,position and rotation in a.json file to be read by phaser.while the position and rotation work perfectly well by changing the pivot of the sprites in unity.the scale doesnt seem to work ie the scaling in unity doesnt show the same result in phaser.if anyone has suggestion on how to calibrate it please let me know.
  4. Hey guys.I wanted to make a fuctionality through which If i select a sprite its gets replaced by a highlighted version of that sprite(the ones with selected in their name) and the other objects become rplaced by their unhighlighted version however with the current code whats happening is when testing the program it seems to be making an stran instance of the unhighlighted versions. function create () { mothership = game.add.sprite(90,100,"mothership"); mothership.inputEnabled=true; mothership.events.onInputDown.add(listener,this); bots=game.add.group();//the bots group bot1=bots.create(400,100,'bot1'); bot1.inputEnabled=true; bot1.events.onInputDown.add(listener,this); bot2=bots.create(700,100,'bot2'); bot2.inputEnabled=true; bot2.events.onInputDown.add(listener,this); } function listener(sprite, pointer) { if(sprite==mothership) { sprite.kill(); MothershipSelect(); Bot1(); Bot2(); } if(sprite==mothershipSelected) { sprite.kill(); Mothership(); } if(sprite==bot1) { sprite.kill(); Bot1Select(); Mothership(); Bot2(); } if(sprite==bot1Selected) { sprite.kill(); Bot1(); } if(sprite==bot2) { sprite.kill(); Bot2Select(); Mothership(); Bot1(); } if(sprite==bot2Selected) { sprite.kill(); Bot2(); } } function MothershipSelect() { mothership.kill(); mothershipSelected = game.add.sprite(80,100,"mothershipSelected"); mothershipSelected.inputEnabled=true; mothershipSelected.events.onInputDown.add(listener,this); } function Mothership() { mothershipSelected.kill(); mothership = game.add.sprite(90,100,"mothership"); mothership.inputEnabled=true; mothership.events.onInputDown.add(listener,this) } function Bot1() { bot1Selected.kill() bot1=bots.create(400,100,'bot1'); bot1.inputEnabled=true; bot1.events.onInputDown.add(listener,this); } function Bot1Select() { bot1.kill(); bot1Selected=bots.create(400,100,'bot1Selected'); bot1Selected.inputEnabled=true; bot1Selected.events.onInputDown.add(listener,this); } function Bot2() { bot2Selected.kill(); bot2=bots.create(700,100,'bot2'); bot2.inputEnabled=true; bot2.events.onInputDown.add(listener,this); } function Bot2Select() { bot2.kill(); bot2Selected=bots.create(700,100,'bot2Selected'); bot2Selected.inputEnabled=true; bot2Selected.events.onInputDown.add(listener,this); }
  5. Guys I have the following code to make a star sprite and 2 firstaidbox(added through group) sprites.what i want is that when i click the star the firstaid boxes should dim(alpha=0.5) and vice versa.however the mouse event doesnt seem to work when I click the firstaid boxes. function create () { starimage = game.add.sprite(100,100,"star"); starimage.inputEnabled=true; starimage.events.onInputDown.add(listener,this) bots=game.add.group();//the firstaid boxes for(var i=2;i<4;i++) { var myvar=bots.create(i*100,100,'firstaid'); myvar.inputEnabled=true; myvar.events.onInputDown.add(listener,this); } } function listener(sprite, pointer) { if(sprite==starimage) { sprite.alpha = 0.5; bots.alpha=1; } if(sprite==bots) { alert("clicked"); sprite.alpha = 0.5; starimage.alpha=1; } }
  6. I know the number of FlappyBird clones flooding the internet is getting a bit ridiculous, but I couldn't resist making one myself! I made the game with Phaser and was pleasantly surprised at how intuitive it feels - all round a great framework. As it was a learning excercise for myself, I've liberally documented the source so hopefully other phaser beginners can benefit from it. Play it here http://arcade.starfish.ie/flappy Hope you enjoy! p.s. my hiscore is 14, can you beat it?
  7. Hi all, Please find the following link http://collegetomato.com/forDhruva/nanoSWAT/curveMovement/ which I have done using construct2 game engine and it took me almost a week to do this. Considering my programming skill of a designer(who also codes sometimes) it would take more time in Phaser. Can you help me out with a code snippet which simulates the action shown in the link The algorithm I have used is ... I am storing the trails as the player is touching the screen and storing the X,Y, direction (relation between previous consecutive trails) in an array which I am looping through and then changing the Y position of the main Sprite when the X of the next trail is less than the main sprite. ..if the current direction is LEFT to RIGHT.similarly changing the Y position of the main sprite if the X of next trail is greater than the main sprite ..if the current direction is RIGHT to LEFT sorry if the explanation for the algo is crude thanks
  8. Dream Of Sleeping

    Is it possible to crop left side of image?

    Hello. I know altering the width of the crop of a sprite takes away from the right side of the image. I really need to crop the left side. I've tried altering the crop x properties but just get a kind of black shadow added on the end. I can't make sense of what is going on. Here is an example. I've cropped the left side of the robot arm, but now you can see the black line going onto the pipe. I need to get rid of that.
  9. EDIT: For those still interested in this issue I have revived it with updated code and such here. Heya, this is my first post so I apologize if this has already been covered in another relevant topic. Essentially I am setting up a HUD prototype. I pass the game object to the HUD initially then prototype all of the relevant functions afterword. I am trying to get a timer setup to essentially display a 1 minute countdown. Each time I try to run the game though I get the error... Uncaught TypeError: Cannot call method 'loop' of undefined Here is the code I am using... ~~~ HUD = function(game) {this.game = game;this.score = 0;this.text = null;//this.timer = null;}; var countDown = 60; HUD.prototype = {create: function() {this.text = this.game.add.text(16, 16, 'Score: 0\nTimer: 01:00', { fontSize: '32px', fill: '#000' });this.game.time.events.loop(Phaser.Timer.SECOND, updateText, this.game);}, update: function() { }}; function updateText() {countDown--; if (countDown < 10) {this.text.content = 'Score: 0\nTimer: 00:0' + countDown;} else {this.text.content = 'Score: 0\nTimer: 00:' + countDown;} if (countDown == 0) {endGame();}} function endGame() {game.state.start('GameOver');}~~~Any thoughts?
  10. I'm trying to make a little game using physics, where the user pushes balls around. The balls are defined as Sprite extensions, like this: function Player(game, type) { Phaser.Sprite.call(this, game, game.world.randomX, game.world.randomY, 'player') this.anchor.setTo(0.5, 0.5) this.type = type this.body.collideWorldBounds = true this.body.allowRotation = true this.body.bounce.setTo(0.6, 0.6) this.body.setCircle(50) this.body.angularDrag = 50 this.body.drag = 5 game.add.existing(this) } And the interaction is based on doing: this.players.getAt(0).body.velocity.x -= 10with every one of the directions, depending on the key pressed. It works, I can push elements around. But I'm facing an issue, I don't know it it's a bug or it's just expected to work like this and I'm missing something. The problem is that the elements overlap in some situations. For example, if I keep pressing the key, forcing the sprite against another one, it may finally "break" the collision boundary and overlap. Is there a solution for this? Is it a known issue? Thank you
  11. miguelfeliciano

    Best Practice for Graphics

    I'm still new to Phaser and have a concern of best practice for loading up images with my main concern being performance. I understand how to load up images and sprites (for characters and such), but I'm building a game much like Scrabble and I created a spritesheet containing all of the images I would need. I was able to load up the board for the game, but now I want to load up the rest of the images in that spritesheet. The only option I can think of is to cut up the spritesheet in PS and have individual images to load up separately; I don't think a tilemap would work in my situation. I was hoping to have one spritesheet (png) to load and just tell Phaser where all of the images are in that spritesheet. I would think this would be something of a best practice instead of loading each image individually. I'm also experimenting with the Tiled app and generating the tilemap data and then loading whatever individual images I need to load; each image would need to be draggable. What other options are available to me?Is there a plug-in that can extend the functionality of the game.load.image function?What's the best practice in this kind of game scenario? Thanks in advance
  12. Hello everybody, I have an issue with a Sprite vs Sprite collision (Phaser 1.1.4 - Master branch). I don't know why but my player only collides with the bottom of the rock. You can see the problem here : http://folia-game.herokuapp.com/index-dev.html The 2 scripts involved are player.js and rock.js (you can see the code with your developer tools too). The rock is immovable and I call the "game.physics.collide()" in the update function of Rock (in rock.js). As you can see on the image below, my player has a specific bounding box (done with the sprite.body.setRectangle() function). I tried but I can't figure it out. Please, help me Thank you.
  13. Arlefreak

    [WIP] Phaser Snippets

    I started working on a Sublime Text Package for phaser Phaser Snippets, the objective is to learn more about phaser on the progress, that's why I'm not automating the process and taking long to finish it. The thing is I have some questions for the comunity beacause there are a lot of method's I havn't really used so I don't know the best way to call them for example for the Animation Manager wich I normally use inside a sprite the snippet output is: .add('name',frames,frameRate,'loop',useNumericIndex);But for Utils class is : Phaser.Utils.pad('str',len, pad, dir);So if someone has some feedback feel free to tell me and I will update the package with the best way of the output, also the repo is on Github So if you wan't to make the process faster do a pull request .
  14. Hello, i recently started trying to work with this engine and got TypeScript and VS2013 running on my laptop. I have followed the first TypeScript tutorial multiple times and it will not display the image.
  15. polkapunk

    Background Color With Canvas?

    I'm having trouble getting the background color to work in canvas mode. The background displays correctly as white if I do this: var game = new Phaser.Game(640, 480, Phaser.AUTO, '', {create: create});function create() { game.stage.backgroundColor = 0xffffff;}But if I change Phaser.AUTO to Phaser.CANVAS, the background color is the default black. I'm using the latest version of Phaser (1.1.4). It's happening to me in both Firefox and Chrome. Does anyone know if this is a bug? Or am I doing something wrong? Any help would be appreciated. Thanks!
  16. JLevstein

    [Help] Phaser Groups and Classes

    Hi there! I'm having an issue with trying to figure out best practices with creating multiple sprites on a screen. I've been using this blog post as a reference for how to structure my game into classes: http://toastedware.com/?p=258 and so far it's been great. I like how neat it leaves my code. However, I've been trying to create multiple instances of a class and whenever a new instance appears, the previous one loses all of its properties and just drops into the ether. Any advice on how to move forward? I've tried creating a group, but I'm not sure how to pass the class into it. For reference, here is my game so far: https://github.com/JLevstein/tigertail/tree/master/js
  17. Robert O'Rourke

    iOS spritesheet scaling problem

    Hello, I've been making a few proof of concept games to move some old games from flash to html5. I've got a simple Simon memory game using a deck of cards set up here. I've set up a spritesheet for the deck of cards so I can just choose a frame to change the card. The cards are arranged in a row and then in columns depending on how many you show and are scaled to fit into as much of the screen as possible. It works on desktop and android but on iOS devices the frames from the sprite sheet are messed up or just don't show. When they do show it looks like there are exactly 4 of the sprites so I'm guessing it's related to the device pixel ratio. Is there something I can do with Phaser.StageScaleMode to compensate? Thanks!
  18. Karma Octopus

    Tilemaps using csv files

    We have a game using Flixel that we are now trying to port to Phaser. The game uses tilemaps made in Dame exported to simple csv files, like this: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,2,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,1,1,1,1,1,1,1,1,0,0,0,00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0My question is now, are there any examples to show how to make tilemaps like this work in Phaser? In theory this might be possible but I have seen no examples of it working, only examples using Tiles and json.
  19. yaroslav kornilov

    How sprite zoomed in in Phaser ?

    I have an idea of 2d-arcade multiplayer game, i tried many frameworks and now i think Phaser is tehe most friendly and easy to learn. But i haven't found way to zoom in sprite in phaser. It's really important in my game becouse it used 16-bit stiled sprites. Is any way how i can do it?
  20. Hey guys! I just recently started screwing around with Phaser and it went great, up untill now... I opened my laptop and started up my XAMPP server to get back to work, then this happened (attached files). I have no idea what happened or what it is doing. Also, here is my code: <html><head> <title>HTML5</title> <script src="phaser.js"></script> <style> body{margin:0; position: absolute; width: 100%; height: 100%;} canvas{margin-left: 15%; margin-top: 8%;} </style> <script src="game.js"></script></head><body> Deaths: <span id="deaths"></span><br> Rounds: <span id="rounds"></span></body></html>window.onload = function(){ // var windowWidth = document.body.clientWidth; // var windowHeight = document.body.clientHeight; var deaths = -3; var game = new Phaser.Game(900,480,Phaser.CANVAS,"", {preload: onPreload, create:onCreate, update:onUpdate}); var theSquare; var xSpeed = 6; var jumpHeight = 70; var jumpWidth = 180; var jumpRotation = 180; var jumpTime = 0; var isJumping = false; var degToRad = 0.0174532925; var floorY = Array(460,230); var floorX; var currentFloor = 0; var floorHeight = 20; var levelStart = 0; var objectStart; var levelEnd = 900; var rounds = 0; function onPreload(){ game.load.image("square", "square.png"); game.load.image("floorsmall", "floorsmall.png"); game.load.image("floormedium", "floormedium.png"); game.load.image("floorbig", "floorbig.png"); } function onCreate(){ var floor1 = game.add.graphics(0,0); floor1.lineStyle(floorHeight, 0x440044, 1); for(i = 0; i < floorY.length; i++){ floor1.moveTo(levelStart, floorY[i] + floorHeight/2); floor1.lineTo(levelEnd, floorY[i] + floorHeight/2); } floorX = Array(game.add.sprite(objectStart,floorY[currentFloor]-game.cache.getImage("floorsmall").height,"floorsmall"), game.add.sprite(objectStart,floorY[currentFloor]-game.cache.getImage("floormedium").height,"floormedium"), game.add.sprite(objectStart,floorY[currentFloor]-game.cache.getImage("floorbig").height,"floorbig")); theSquare = game.add.sprite(levelStart,floorY[currentFloor]-game.cache.getImage("square").height/2,"square"); theSquare.anchor.setTo(0.5, 0.5); game.input.onDown.add(jump, this); if (currentFloor == 0){ objectStart = Array(250, 450, 650); for(i = 0; i < floorX.length; i++){ floorX[i].x = objectStart[i]; } } } function jump(){ if(!isJumping){ jumpTime = 0; isJumping = true; } } function collHandler(obj1, obj2){ if(game.physics.overlap(obj1, obj2)){ theSquare.x = levelStart; deaths = deaths + 1; document.getElementById('deaths').innerHTML = deaths; rounds = 0; } } function onUpdate(){ for(i = 0; i < floorX.length; i++){ collHandler(theSquare, floorX[i]); } var mod = currentFloor % 2; theSquare.x += xSpeed * (1 - 2 * mod); if(theSquare.x > levelEnd && mod == 0 || theSquare.x < levelStart && mod == 1){ currentFloor++; if(currentFloor > floorY.length - 1){ currentFloor = 0; } mod = currentFloor % 2; //WERKT NIET!!!!! if(theSquare.x == levelStart){ currentFloor = 0; rounds = rounds + 1; alert('ok'); document.getElementById('rounds').innerHTML = rounds; } isJumping = false; theSquare.rotation = 0; theSquare.x = levelEnd * mod + levelStart * (1 - mod); theSquare.y = floorY[currentFloor]-game.cache.getImage("square").height / 2; } if(isJumping){ var jumpFrames = jumpWidth / xSpeed; var degreesPerFrame = jumpRotation / jumpFrames * (1 - 2 * mod); var radiansPerFrame = (180 / jumpFrames) * degToRad; jumpTime++; theSquare.angle += degreesPerFrame; theSquare.y = floorY[currentFloor]-game.cache.getImage("square").height / 2 - jumpHeight * Math.sin(radiansPerFrame * jumpTime); if(jumpTime == jumpFrames){ isJumping = false; theSquare.y = floorY[currentFloor]-game.cache.getImage("square").height / 2; } } } function onRender(){ } }; // window.onresize = function(e){ // var theCanvas = document.querySelector('canvas'); // theCanvas.height = document.body.clientHeight + 'px'; // theCanvas.width = document.body.clientWidth + 'px'; // }It's not perfect, but it works... Well, worked. Anybody who has an idea?
  21. Hey, I am looking to have a bunch of sprites move around and then have a function linking to a button which when pressed halves the x speed of all sprites in the group and then when pressed again returns the speeds to the original value. It needs to work for all objects in the group which may be travelling in different x speeds and in different directions. I have tried to implement something but some platforms are using tweens to move backwards and forwards and I can't see a way to do this with tweens? Would it be better to try and just use the velocity of each object in the group without using tweens at all? Thanks for any help
  22. yaroslav kornilov

    Something bad with code.

    Plese help me with this code, it work's good first 5-6 seconds and then crash(all sprites stop), i don't know to do with it: //begin var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); var MainHero;//окvar Zombie;//окvar upKey;//окvar leftKey;//окvar rightKey;//окvar bullet;var bullets;var bulletTime = 0;var backgroundimage; function preload() { game.load.spritesheet('MainHero', 'playerwithpistol.png', 17, 9, 24); //главный герой game.load.spritesheet('Zombie','zombies.png', 11, 15, 6); // враги game.load.image('bullet', 'bullet.png'); //пуля game.load.image('backgroundimage','backgroundimage.jpg');//фон} function create() { //главный герой MainHero = game.add.sprite(30, 400,'MainHero'); MainHero.animations.add('left', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 10, true);//идти влево MainHero.animations.add('right', [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], 10, true);//идти в право upKey = game.input.keyboard.addKey(Phaser.Keyboard.UP); leftKey = game.input.keyboard.addKey(Phaser.Keyboard.LEFT); rightKey = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); //пули bullets = game.add.group(); bullets.createMultiple(10, 'bullet'); bullets.callAll('events.onOutOfBounds.add', 'events.onOutOfBounds', resetBullet, this); //enemy Zombie = game.add.sprite(600,30,'Zombie'); Zombie.animations.add('walk'); Zombie.animations.play('walk', 20, true); } function update() { MainHero.body.velocity.x = 0; MainHero.body.velocity.y = 0; //input getting if (leftKey.isDown) { MainHero.x--; MainHero.animations.play('left', 10, true); } else if (rightKey.isDown) { MainHero.x++; MainHero.animations.play('right', 10, true); } if (game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)) { fireBullet(); } if (upKey.isDown && MainHero.body.touching.down) { MainHero.body.velocity.y = -350; } } //отдельный модуль 2function resetBullet (bullet) { bullet.kill();} //отдельный модульfunction fireBullet () { if (game.time.now > bulletTime) { bullet = bullets.getFirstExists(false); if (bullet) { bullet.reset(MainHero.x + 3, MainHero.y - 8); bullet.body.velocity.x = +300; bulletTime = game.time.now + 250; } } } //end. // //function create() { ///platforms = game.add.group(); ///var ground = platforms.create(0, game.world.height - 64, 'ground'); //ground.scale.setTo(2, 2); //ground.body.immovable = true; //var ledge = platforms.create(400, 400, 'ground'); ///ledge.body.immovable = true; //ledge = platforms.create(-150, 250, 'ground'); //player.body.gravity.y = 6; //}//отдельный конструктор //самое важное//функция взаимодействия thank's
  23. Hey, I have a platform which is having the body.velocity.x tweened back and forward. If my sprite jumps on the platform the platform moves along the x axis without taking the sprite with it, and the sprite kind of slips off. Is there any properties I could use which may make the sprite move with the platform? Cheers
  24. Hello, I need some help. I want to draw something on BitmapData and add it to the stage. I've tryed this code (it's "create" function of my state): this.backBMD = this.game.add.bitmapData(this.game.width, this.game.height);this.backBMD.strokeStyle('#fff');this.backBMD.beginPath(); this.backBMD.moveTo(0, 0);this.backBMD.lineTo(100, 100);this.backBMD.add(new Phaser.Sprite(this.game, 50, 50, 'ball_blue'));this.game.add.sprite(50, 50, this.backBMD);I draw a line and add sprite to my bitmapData. Then I add it as a sprite and see nothing on my canvas. However, this code is working fine: this.game.add.sprite(50, 50, 'ball_blue'); Is it correct approach, or I've made some mistake? Thanks, in advance.
  25. Hello again! Maybe this question was already answered, but I couldn't find it. So, sorry if I'm repeating it! I'm almost finishing one game I made, and I've tried to run it on a Samsung Galaxy Tab 10.1's chrome browser. When the game starts, the background is tweened normally, but the cards (which are all in the same texture atlas) are not drawed. Also my sound isn't working either. Can anybody help me? One of my intents with phaser is to deploy in Android, so I would be very grateful if someone can tell me a solution. ​Thanks for your time!