skywalker

Members
  • Content count

    13
  • Joined

  • Last visited

About skywalker

  • Rank
    Member

Contact Methods

  • Twitter
    https://twitter.com/skywalkerprog

Recent Profile Visitors

289 profile views
  1. html5 game

    thanks guys for feedback i think you are all right it is very hard i thought hardness make the game challenging i would like to say that i fiend feedback from others is the most useful thing in game dev journey , i learn alot from feedback more than tuts , courses thanks again <3 love Phaser
  2. html5 game

    Hi i would like to share with you my last game i made with phaser framework it is cross platform mobile ready game the source code is available on codecanyon codecanyon : https://goo.gl/H2nvea play the game : https://goo.gl/MojVRz video : https://goo.gl/gnl2fq
  3. i made a simple on game controller for a game when test it with coconjs it sometimes freezes and not responding to touch specially on slow devices then it works and so on this.sprite.events.onInputDown.add(function(){ console.log("down") if (GAME.paused == false) { this.sprite.alpha = 1; this.pressed = true; }; }, this); this.sprite.events.onInputUp.add(function(){ if (GAME.paused == false) { this.sprite.alpha = 0.35; this.pressed = false; }; }, this); and they are fixed to camera
  4. stile black screen it work fine on firfox but not chrome
  5. hello everyone im making a game with phaser and i want to take a screenshot from one scene and draw it to another by using game.canvas.toDataURL(); this is what i have tried so far in the first scene GAME.cc = game.canvas.toDataURL(); second one var img = new Image(); img.onload = function(){ var base = new PIXI.BaseTexture(this), texture = new PIXI.Texture(base); var sp = game.add.sprite(0,0); sp.setTexture(texture); }; img.src = GAME.cc; there is no error in console but the sprite is completely black !! so ... what is the problem . on stackoverflow http://stackoverflow.com/questions/29733356/draw-base64-png-data-with-phaser-js
  6. im trying to make a circle button with tap event i used hitArea property from sprite class and using pixi Circle class i did that this.sprite = game.add.sprite(50,50,"cursors"); this.sprite.anchor.set(0.5,0.5); this.sprite.hitArea = new PIXI.Circle(50,50,84); this.sprite.inputEnabled = true; this.sprite.events.onInputDown.add(function(){ console.log("clicked"); }); }; it is not working at all so i tried removing this.sprite.anchor.set(0.5,0.5); input is work fine when there is no hit Area so what should i do note : phaser version is 2.2.2
  7. i created 2 sprites and added p2 body for each of them first on is the player it is , second is static and when i checkd for collision for each of them it works but only if the second one is not moving when i move the second sprite around the world for example this.update = function(){ block.body.x = block.body.x -1; }; it is not collide with the other sprite what is the problem :/ !
  8. im a beginner in Phaser.js game development and i want to create static body to group , with p2 physic system i created the group and then started the physic system. var block_group = game.add.group(); var Y = 20; for (var i = 0; i < numberOfBlocks; i++) { block_group.create(400,Y,'block'); Y = Y +15; }; game.physics.startSystem(Phaser.Physics.P2JS); block_group.enableBody = true; block_group.physicsBodyType = Phaser.Physics.P2JS; when i print block_group.body it gives me undefined so i tried using forEachAlive and it stile the same however it works fine for single sprite , but with a group it is not working .
  9. box2d support it is crazy idea but if there is scene editor for framework will be better
  10. hi i made a game with phaser last version it works fine in web but in mobile devices its become very slow the game is about cars and racing something like that i package it to APK with crosswalk i tried coconjs it is not working only black screen show up and then nothing please help me to solve my problem
  11. i tried all the ways in the topic nothing work correctly
  12. function create(){ game.stage.disableVisibilityChange = true; if (game.device.desktop) { game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.maxWidth = 1440; game.scale.maxHeight = 960; game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; game.scale.setScreenSize(true); var ow = parseInt(this.game.canvas.style.width,10); var oh = parseInt(this.game.canvas.style.height,10); var r = Math.max(window.innerWidth/ow,window.innerHeight/oh); var nw = ow*r; var nh = oh*r; game.canvas.style.width = nw+"px"; game.canvas.style.height= nh+"px"; game.canvas.style.marginLeft = (window.innerWidth/2 - nw/2)+"px"; game.canvas.style.marginTop = (window.innerHeight/2 - nh/2)+"px"; document.getElementById("gameContainer").style.width = window.innerWidth+"px"; document.getElementById("gameContainer").style.height = window.innerHeight-1+"px";//The css for body includes 1px top margin, I believe this is the cause for this -1 document.getElementById("gameContainer").style.overflow = "hidden"; console.log(nw); }else{ game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.maxWidth = 1440; game.scale.maxHeight = 960; game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; game.scale.forceOrientation(true, false); //game.scale.hasResized.add(this.gameResized, this); //game.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); //game.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); game.scale.setScreenSize(true); game.scale.setShowAll(); game.scale.refresh(); // below code is not working /*var ow = parseInt(this.game.canvas.style.width,10); var oh = parseInt(this.game.canvas.style.height,10); var r = Math.max(window.innerWidth/ow,window.innerHeight/oh); var nw = ow*r; var nh = oh*r; game.canvas.style.width = nw+"px"; game.canvas.style.height= nh+"px"; game.canvas.style.marginLeft = (window.innerWidth/2 - nw/2)+"px"; game.canvas.style.marginTop = (window.innerHeight/2 - nh/2)+"px"; document.getElementById("gameContainer").style.width = window.innerWidth+"px"; document.getElementById("gameContainer").style.height = window.innerHeight-1+"px";//The css for body includes 1px top margin, I believe this is the cause for this -1 document.getElementById("gameContainer").style.overflow = "hidden"; */ }; hi im a beginner phaser js game developer i made a small games that responsive all screen and i have problem with mobile devices there is black border around the game stage i want my game to fit all the screen without losing the resolution i used the code in this tobic http://www.html5gamedevs.com/topic/5949-solution-scaling-for-multiple-devicesresolution-and-screens/ it is only works for desktop browser see attachment ile 1 it is small test but in the mobile device it looks like that i want solve this problem to it my mobile screen without losing resolution here is the code i use or Boot
  13. hi im building car game , i want my car move around with no limits look to attached file the code is this.preload = function(){ game.load.image('redCar', 'assets/images/redCar.png'); game.load.image('picture2', 'assets/images/policCar.png'); game.load.image('land','assets/images/scorched_earth.png') }; this.create = function(){ game.world.setBounds(-3000, -3000, 4000, 4000); land = game.add.tileSprite(-3000, -3000, 4000, 4000, 'land'); //land.fixedToCamera = true; redCar = game.add.sprite(300, 500, 'redCar'); game.camera.follow(redCar); //redCar.anchor.setTo(0.5, 0.5); game.physics.enable(redCar, Phaser.Physics.ARCADE); redCar.body.drag.set(0.2); redCar.body.maxVelocity.setTo(400, 400); redCar.body.collideWorldBounds = true; redCar.body.allowRotation = false; redCar.anchor.setTo(0.5, 0.5); //redCar.body.drag.set(0.2); //redCar.body.maxAngular = 500; //redCar.body.angularDrag = 500; redCar.angle =90; cursors = game.input.keyboard.createCursorKeys(); //redCar.body.angularAcceleration = 0; }; this.update = function(){ if (currentSpeed > 0) { game.physics.arcade.velocityFromRotation(redCar.rotation, currentSpeed, redCar.body.velocity); } if (cursors.up.isDown) { currentSpeed += 5; if (currentSpeed>=500) {currentSpeed = 500}; }else{ if (currentSpeed>0) { currentSpeed -= 4; // if (currentSpeed<0) {currentSpeed=0}; }; }; if (cursors.right.isDown && currentSpeed >0) { redCar.angle += 2; //console.log(currentSpeed); }else if(cursors.left.isDown && currentSpeed >0) { redCar.angle -= 2; }; };