mohammed alsaqqal

Members
  • Content Count

    8
  • Joined

  • Last visited

About mohammed alsaqqal

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. thank you ... its helpful some how .. but the thing that i want to do is when i drag the object the , then the object will has the velocity and the angle of pointer ... and go to it when i stop draging .. i hope you catch my point
  2. thank you .. its useful i have some ideas ,... but i dont know what codes i should use :\
  3. i want a way to make the pointer or input catch a moving object and shoot or throw it to a any direction that user want >> like i want to catch a moving balls .. and shoot or throw it to it home ..
  4. thank you >>> the problem was in the spelling .. its Phaser not phaser but i have another problem .. the update function of prefab not work !! BasicGame.balls.prototype.update
  5. im trying to move this prefab in random way var BasicGame = BasicGame || {}; BasicGame.balls = function(game ,x,y ,vx,vy, key) { Phaser.Sprite.call(this,game,x,y,vx,vy,key); this.game=game; this.game.physics.arcade.enable(this) ; this.body.collideWorldBounds = true; this.body.bounce.setTo(1, 1); this.body.velocity.x = vx; this.body.velocity.y = vy; this.body.immovable = true; this.body.drag = true ; }; BasicGame.balls.prototype = Object.create(Phaser.Sprite.prototype); BasicGame.balls.prototype.constructor = BasicGame.balls ; this is main js create function code var ball1 = ['greenb1' , 'greenb2' , 'greenb3' , 'greenb4' , 'blueb1' ,'blueb2' , 'blueb3' , 'blueb4' , 'redb1' , 'redb2' , 'yellowb1','yellowb2','orangeb1','orangeb2' , 'silverb1' , 'silverb2' , 'pinkb1' , 'pinkb2'] ; var x = this.game.world.randomX; var y = this.game.world.randomY; this.minSpeed = -75; this.maxSpeed = 75; var vx = Math.random()*(this.maxSpeed - this.minSpeed+1)-this.minSpeed; var vy = Math.random()*(this.maxSpeed - this.minSpeed+1)-this.minSpeed; var b1 = new BasicGame.balls( this.game ,x,y ,vx , vy ,Phaser.ArrayUtils.getRandomItem(ball1)); //Phaser.ArrayUtils.getRandomItem() this.game.add.existing(b1) ;
  6. im trying to make a prefabs and this is the code of .js file var BasicGame = BasicGame || {}; BasicGame.balls = function(game ,x,y ) { Phaser.Sprite.call(this,game,x,y); this.game=game; this.game.physics.Arcade.enable(this) ; this.anchor.setTo(0.5) ; this.body.velocity = this.game.RandomDataGenerator ; }; BasicGame.balls.prototype = Object.create(Phaser.Sprite.prototype); BasicGame.balls.prototype.constructor = BasicGame.balls ; and this is the html code <!DOCTYPE HTML> <html> <head> <title>Phaser Full Screen Mobile Example</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="chrome=1, IE=9"> <meta name="format-detection" content="telephone=no"> <meta name="HandheldFriendly" content="true" /> <meta name="robots" content="noindex,nofollow" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-title" content="Phaser App"> <meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0 minimal-ui" /> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <!-- non-retina iPhone pre iOS 7 --> <link rel="apple-touch-icon" sizes="57x57" href="icons/app_icon_57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="icons/app_icon_60x60.png"> <!-- non-retina iPad pre iOS 7 --> <link rel="apple-touch-icon" sizes="72x72" href="icons/app_icon_72x72.png"> <!-- non-retina iPad iOS 7 --> <link rel="apple-touch-icon" sizes="76x76" href="icons/app_icon_76x76.png"> <!-- retina iPhone pre iOS 7 --> <link rel="apple-touch-icon" sizes="114x114" href="icons/app_icon_114x114.png"> <!-- retina iPhone iOS 7 --> <link rel="apple-touch-icon" sizes="120x120" href="icons/app_icon_120x120.png"> <!-- retina iPad pre iOS 7 --> <link rel="apple-touch-icon" sizes="144x144" href="icons/app_icon_144x144.png"> <!-- retina iPad iOS 7 --> <link rel="apple-touch-icon" sizes="152x152" href="icons/app_icon_152x152.png"> <link rel="apple-touch-icon" sizes="256x256" href="icons/app_icon_256x256.png"> <link rel="apple-touch-icon" sizes="512x512" href="icons/app_icon_512x512.png"> <link rel="apple-touch-icon" sizes="1024x1024" href="icons/app_icon_1024x1024.png"> <link rel="stylesheet" href="css/stylesheet.css" type="text/css" charset="utf-8" /> <!-- Load Phaser engine --> <script src="lib/phaser.min.js"></script> <!-- Load game source files --> <script src="src/Game.js"></script> <!-- Load game entrance --> <script src="src/app.js"></script> <!-- Load and initialize Cordova --> <script src="cordova.js"></script> <script src="src/cordova-init.js"></script> <script src="src/prefabs/balls.js"></script> <script src="src/prefabs/homes.js"></script> </head> <body> <!-- Main canvas for rendering game stage --> <div id="game"></div> <div id="balls"></div> <div id="homes"></div> </body> </html> if you notice in the pic ... i have an error // 'phaser' is not defined please help !
  7. im trying to chose randomly from my array var balls = game.add.group(); balls.enableBody = true; var l = ['greenb1' , 'greenb2' ,'greenb3' ,'greenb4' , 'redb1' ,'redb2' , 'blueb2', 'blueb2' , 'blueb3' ,'blueb4' , 'yellowb1' , 'yellowb2' , 'orangeb1' ,'orangeb2'] ; for(var i = 0 ; i<(10 + Math.random() * 40) ; i++){ var s = aliens.create(game.world.randomX, game.world.randomY, l[Math.floor(Math.random() * myShows.length)]); s.name = 'ball' + s; s.body.collideWorldBounds = false; s.body.bounce.setTo(1, 1); s.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40); }