pinastroHTML5

Members
  • Content Count

    8
  • Joined

  • Last visited

  1. 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
  2. pinastroHTML5

    Camera moves only one pixel

    did you check the camera culling example in the PHASER EXAMPLES folder ?
  3. pinastroHTML5

    selecting and unselecting a sprite

    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 : http://collegetomato.com/query_on_selectionandUnselection.jpg 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; sprite.events.onInputDown.add(spriteInputListener,this); sprite2.inputEnabled=true; sprite2.events.onInputDown.add(spriteInputListener2,this); // sprite3.inputEnabled=true; // sprite3.events.onInputDown.add(spriteInputListener3,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. pinastroHTML5

    continuous Bezeir kind of curve in on the mouse trail

    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. pinastroHTML5

    continuous Bezeir kind of curve in on the mouse trail

    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. pinastroHTML5

    continuous Bezeir kind of curve in on the mouse trail

    oops sorry I meant this http://gametest.mobi/phaser/examples/_site/view_full.html?d=display&f=render+texture+trail.js&t=render%20texture%20trail 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 http://collegetomato.com/trail.png 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 http://coil.clay.io/ 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
  8. pinastroHTML5

    moveToPointer/angleToPointer for a sprite?

    can you give the example here