• Content Count

  • Joined

  • Last visited

  1. Hi all, Please find the following link 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
  2. did you check the camera culling example in the PHASER EXAMPLES folder ?
  3. Hi all, I am a game designer and was mostly working with construct2 and very new to PhaserJS so please forgive my "super-simple" sometimes even trivial questions. Here's the question I have two images taken out of same spritesheet using the json atlas map. In this case both the stars are in yellow in color. Now when you click on any one of the stars the star turns grey which I am able to do using the event listener of the mouse input function. Same works independently for the other sprite as well. Now I want to make it like the following : " when we click on one star the other star should automatically get unselected AND when we click anywhere on the screen apart from the sprite, the all the sprites in the screen should automatically get unselected" The point is at any given time only one sprite should be in SELECTED state. Something like this : Following is my "NOOB" code You can forgive me for my simple question as I am basically a designer and trying some hand on coding. <!doctype html> <html> <head> <title>Phaser</title> <script type="text/javascript" src="js/phaser.min.js"></script> </head> <body> <script type="text/javascript">var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update }); function preload() { game.load.atlasJSONHash('starJSON', 'assets/stars.png', 'assets/stars.json'); } function create() { sprite = game.add.sprite(20,20,'starJSON',2); sprite2 = game.add.sprite(400,20,'starJSON',2); //sprite3 = game.add.sprite(60,20,'starJSON',2); sprite.inputEnabled=true;,this); sprite2.inputEnabled=true;,this); // sprite3.inputEnabled=true; //,this); } function update() { } function spriteInputListener() { sprite.destroy(); game.add.sprite(sprite.x ,sprite.y,'starJSON',1);} function spriteInputListener2() { game.add.sprite(sprite2.x,sprite2.y,'starJSON',1);} // function spriteInputListener3() { // game.add.sprite3(60,20,'starJSON',1);//}</script></body></html>Thanks
  4. Cool. I got it Next working on smoothening the curve now using sampling technique, dont know if that is the best option...lot of arrays I guess In case you have any easier method ..suggest me one thanks
  5. hey members thanks for the response . It was really a cool one... thanks but I am a sort of noob in programming I did get most of it but please help me out understanding the code u have sent ... i tried the same code doesnt seem to be working .... though the link u shared is working .... this is my understanding , [ please forgive my noobness...i am not a full time programmer ..may be that's why] blackoutGraphics() is for resetting the screen to black again preload, create and update are as usual but in update there are three main conditions which I understand only partially if(game.input.mousePointer.isDown) { if(!wasDown) { // NEW CLICK // RESETTING ALL THE PARAMETERS } if(pathIndex == 0 || (path[pathIndex - 1].x ! = game.input.x || path[pathIndex-1].y != game.input.y) ) { // ???????? // Probably drawing a line between two consecutive points ????? } else //else condition also not clear because the if condition was not clear { } if (path != null && path.length > 0 && pathSpriteIndex < pathIndex) { //this condition is probably for moving the star.png across the line till the covered distance is over } }
  6. oops sorry I meant this Something i have created using another html5 framework looks like this..i want to move that blue dot across the trail ...which should be a continous line instead of a trail with uneven spaces Thanks
  7. Hi all, I dont know if this has been answered already but can you help me in this. I want to create an effect something like in this game using PhaserJS The existing example of texture trail seems to be jittery and NOT SMOOTH http://localhost/phaser-master/phaser-master/examples/_site/view_full.html?d=display&f=render+texture+trail.js&t=render%20texture%20trail do tell me is there any lightweight way. A worked out sample would be really helpful thanks