Arcanorum

Members
  • Content Count

    157
  • Joined

  • Last visited


Reputation Activity

  1. Like
    Arcanorum got a reaction from Kraken in Try my flappy bird game   
    Its ok. Try using a timer to make the bubble effect ware off after a few seconds, and try using circle physics bodies for the fish, bubble and urchin.
  2. Like
    Arcanorum got a reaction from MeMyMo in Some help/direction with moving client logic to the server   
    Some other thoughts if you want to do the physics on the server.
     
  3. Like
    Arcanorum got a reaction from Igor Georgiev in Why my physics arcade overlap function is not working   
    If you want the overlap between the two bodies to be checked every game update then yes it should be in the update function. Otherwise you can call it just when you need it, like when some other event happens. If for example you have a player that can move into things, you could just do the overlap/collision checks when the move input is down.
  4. Like
    Arcanorum got a reaction from samme in How to create a sprite with two colliders, where only one triggers callback but doesn't trigger colliision.   
    Looks like you need p2.Broadphase.aabbCheck(bodyA,bodyB);
  5. Like
    Arcanorum got a reaction from jjcale in [Solved] Virtual Joystick's transparency after game.state.start()   
    I ran into this issue too. What I realised was going on is that the virtual joystick/button sprites are added to the stage, so that it appears above everything else, but as a result it is not removed when the state is changed, or restarted.
    You need to use
    this.stick.destroy(); this.buttonA.destroy(); when leaving the state to remove it properly.
  6. Like
    Arcanorum got a reaction from Conflux in Tap, double tap and buttons   
    This is intended behaviour. A double tap natually must have a single tap first. See this example. https://phaser.io/examples/v2/input/on-tap
    To get the kind of double tap that you want, you will have to do it yourself by starting a timer on the first tap and checking if the next tap is within a time threshold for it to be considered a double tap, which is what I had to do before double tap was a feature at all.
    Also, the running of button callbacks and input events are independent. The this.input.onTap.add(onTap, this); will run your onTap callback any time there is a tap, on any part of the game, whether it is also over a button or not.
  7. Like
    Arcanorum reacted to lewster32 in A Problem about body   
    Try this:
    this.role.longPaoXiao.body.reset(this.role.x,this.role.y); Resetting the sprite position while the body is influencing it will often lead to incorrect positioning, the item flying off the screen or other problems. When the body is in control of the sprite's positioning, you should be using body.reset, body.velocity and so on to move it. If you don't want the physics to influence the sprite's movement, you can set body.moves = false and then move the sprite as normal.
  8. Like
    Arcanorum reacted to adamsko in Sprite + physics: changing sprite's coordinates.   
    Hello. I've noticed that many people have a similar problem.
    If sprite has physics enabled: how to change its position without interfering with physics system?
    It's a famous 'fly off the screen' problem. If position is changed, physics system is using new coordinates to continue its work, hence sprite's surprising behavior.
    Let's say,that sprite is moving and when it's clicked it should move 100px on the right and then continue its movement), maybe with a different speed. How to achieve that?
    My solution is:
    sprite.body.moves = false;object.sprite.x += 100; ... and then in game's update() function:
    function update() { sprite.body.reset(sprite.x, sprite.y); sprite.body.velocity.x = 10; // new velocity sprite.body.moves = true;} I understand, that physics system must be after one update, otherwise switching between
    body.moves = false and
    body.moves = true will not have a chance to work.
     
    After that sprite is translated 100px in the right, plus it has new velocity.
    The question is: is there a proper Phaser way to achieve that without splitting this operation on instructions executed before and after update() function?
     
    It's seems like a common need and yet it takes that little extra effort to achieve desired effect
  9. Like
    Arcanorum got a reaction from WiLD11 in The Evolution of Phaser 3 and Lazer   
    Will Arcade Physics 2 be tied to display objects?
  10. Like
    Arcanorum got a reaction from samme in Super Dungeon Flash   
    Here's a game that I have been working on for a while now that I feel is at the stage where it should be shown to the world.
    This game started off as a simple college project for a programming class last year using Flash, that turned into something quite interesting and fun to make. Knowing that Flash was on the way out, I've just spent the last few weeks causally porting the game over to Phaser, adding more functionality, levels, sounds and fixing some issues.
    The original Flash game can be found at http://www.waywardworlds.com/games/dungeon-flash/index.html
     
    The game concept and mechanics are very simple, yet I can't think of any other game like it. It seems unique. Wiggle and sprint your way through monster ridden scenarios, moving as fast as you can press the movement keys. Gather as much loot as you can on your way to the exit ladder, but be quick about it, as there is a time limit. Any spare time you have left at the end of each level gets added to your score, so don't mess about!
    Try Super Dungeon Flash and tell me what you think!
     http://www.waywardworlds.com/games/df2/index.html

  11. Like
    Arcanorum got a reaction from stevepdp in The new .GAME/.GAMES TLDs   
    Those pages don't get updated regularly.
    .games will be available later in the year. http://www.develop-online.net/news/games-websites-to-be-made-available-to-studios-later-this-year/0219958
  12. Like
    Arcanorum got a reaction from Heron in Name following the player with delay   
    Same problem: 
    Your problem is in Game.js:
    if(game.player.deltaX !== 0 || game.player.deltaY !== 0){ game.player.name.x = game.player.x; game.player.name.y = game.player.y - 50; this.socket.emit("movePlayer", {x: game.player.x, y: game.player.y}); } You should not be moving objects around by manually setting the x/y values in this situation. You should attach the name to the player as a child. In player.js, add player.addChild(player.name); after creating the name text object.
    Also, I wouldn't recommend generating your player ID on the client. Make it on the server when the client connects then send it to them.
    var PlayerID = Math.floor(Math.random() * (999999 - 100000 + 1)) + 100000; Just looks wrong...
  13. Like
    Arcanorum got a reaction from heisenthurg in Set Velocity.X based on which part of sprite is clicked   
    The simplest way of just having left/right detection I can think of is to have two buttons, each one is half as wide as the ball sprite, and attach them to the ball. Each button when pressed, gives a left/right velocity.

    Perhaps a more elegant solution would be when the ball is pressed, calculate if the input down X is more or less than the X of the center of the ball sprite. If input down X is greater than the center X of the ball sprite, the right half of the sprite was pressed. Else, must have been left side.
     
  14. Like
    Arcanorum got a reaction from gabdab in phaser matrix rotation   
    I'm not sure what you are trying to achieve here. You wouldn't need anything to do with physics for finding an image center.
    Display objects (sprites, images, buttons, etc.) have an 'anchor' property which is the reference point around which transformations are done for that object.
    You can change this with 'tank.anchor.setTo(x, y);'.
    What are you using a matrix for exactly?
  15. Like
    Arcanorum got a reaction from vicboma in Super Dungeon Flash   
    Here's a game that I have been working on for a while now that I feel is at the stage where it should be shown to the world.
    This game started off as a simple college project for a programming class last year using Flash, that turned into something quite interesting and fun to make. Knowing that Flash was on the way out, I've just spent the last few weeks causally porting the game over to Phaser, adding more functionality, levels, sounds and fixing some issues.
    The original Flash game can be found at http://www.waywardworlds.com/games/dungeon-flash/index.html
     
    The game concept and mechanics are very simple, yet I can't think of any other game like it. It seems unique. Wiggle and sprint your way through monster ridden scenarios, moving as fast as you can press the movement keys. Gather as much loot as you can on your way to the exit ladder, but be quick about it, as there is a time limit. Any spare time you have left at the end of each level gets added to your score, so don't mess about!
    Try Super Dungeon Flash and tell me what you think!
     http://www.waywardworlds.com/games/df2/index.html

  16. Like
    Arcanorum got a reaction from Skuzzi in Phaser runs extremely inconsistently   
    Do you get the same results on other browsers?
    Can you put the game up running somewhere so we can try ourselves, or just the code?
  17. Like
    Arcanorum got a reaction from drhayes in How an object attribute functions in phaser know other functions   
    If you want to see what 'this' is actually referring to at a particular point, just do 'console.log(this);'.
    In your code, the Play state is the "owner" of the create function, so 'this' refers to the currently running state. Each state has a property 'game', which is a reference to the Phaser game object. In general, you should be trying to add things to the state itself, rather than to the game object.
    I would recommend removing the '.game' from 'this.game.physics.startSystem(Phaser.Physics.ARCADE);', so that the physics system is started for this state only. Every time you are doing 'this.game.add.group()' is also adding those groups to the game object, not to the state.
  18. Like
    Arcanorum got a reaction from elitian in How an object attribute functions in phaser know other functions   
    If you want to see what 'this' is actually referring to at a particular point, just do 'console.log(this);'.
    In your code, the Play state is the "owner" of the create function, so 'this' refers to the currently running state. Each state has a property 'game', which is a reference to the Phaser game object. In general, you should be trying to add things to the state itself, rather than to the game object.
    I would recommend removing the '.game' from 'this.game.physics.startSystem(Phaser.Physics.ARCADE);', so that the physics system is started for this state only. Every time you are doing 'this.game.add.group()' is also adding those groups to the game object, not to the state.
  19. Like
    Arcanorum got a reaction from fillmoreb in Disable mouse inputs   
    You will need to keep track of which sprite is currently 'selected', and only do moveToPointer for that sprite. You can do this by adding an onInputDown event to your sprites. Whenever each sprite that has that event is pressed on, the code will run. Something like this:
    // Hold a reference to the selected sprite. selectedSprite; // Enable the sprite for input so it can be clicked on. sprite1.inputEnabled = true; // Add an event to the sprite. sprite1.events.onInputDown.add(function () { // Make sprite1 the current selection. selectedSprite = sprite1; }, this); sprite2.inputEnabled = true; sprite2.events.onInputDown.add(function () { // Make sprite2 the current selection. selectedSprite = sprite2; }, this); Then you can do stuff to one sprite at a time, using selectedSprite.
  20. Like
    Arcanorum got a reaction from WombatTurkey in Super Dungeon Flash   
    With tablet I assume you had to use the virtual D-pad thing? I haven't tested it much as adding it was a bit of an afterthought. I found it to be unreliable when tapping quickly, and it also kind of gets in the way if you need to go in the bottom left of the screen. I guess nothing will be able to compare to the snappy response of keyboard keys for this kind of game.
  21. Like
    Arcanorum reacted to JazzAceman in Forum Banner Contest   
    Comic style - Had some funny hours making it, hope you enjoy it! :-)

  22. Like
    Arcanorum got a reaction from Tilde in Tilemap tiles not colliding with sprite   
    So I'm trying to enable collision between my player's sprite and a tilemap.
    The JSON map (made in Tiled) has multiple layers. Some of the layers use some of the same tiles for an overlaying effect.
     
    I've looked at this example and have done as it does but I can't get any collision working for any of the layers in the tilemap. The player just moves straight through all of the tile IDs that I have set for collision with .setCollision unhindered.
     
    For those wondering, the player sprite is moving with velocity using .moveToPointer( ... ), not absolute transforms.
     
    Le code:
    var map;var layerBackground;var layerObjects1;var layerObjects2;var layerObjects3;function preload(){ game.load.tilemap('firstMap', 'assets/maps/Magic Map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('spriteSheet', 'assets/maps/map_spritesheet.png'); ...}function create(){ game.physics.startSystem(Phaser.Physics.ARCADE); map = game.add.tilemap('firstMap'); map.addTilesetImage('map_spritesheet', 'spriteSheet'); // Not sure how Phaser handles the same tile being used on // multiple tilemap layers, so I try them all just in case. // #23 on my tileset represents a big rock that I want collision for. map.setCollision(23, true, layerObjects1); map.setCollision(23, true, layerObjects2); map.setCollision(23, true, layerObjects3); // Are there any special rules for putting all the layers of // a tilemap into a game.add.group()? layerBackground = map.createLayer('Background'); layerObjects1 = map.createLayer('Objects1'); layerObjects2 = map.createLayer('Objects2'); layerObjects3 = map.createLayer('Objects3'); // I have seen some other people that used multiple layers // call .resizeWorld() for each layer. Is this necessary? // I assumed it should only be done once (i.e. the biggest layer). layerBackground.resizeWorld(); ...}function update(){ // I'm guessing having all the layers in a group would // make checking collision neater. game.physics.arcade.collide(player.sprite, layerObjects1); game.physics.arcade.collide(player.sprite, layerObjects2); game.physics.arcade.collide(player.sprite, layerObjects3); ...} Are there any obvious errors with what I'm doing? It all looks legit to me from my understanding of the documentation and examples, but still no success. =(
     
    I've already wasted a reasonable amount of time on this problem. Thanks for any help.
  23. Like
    Arcanorum got a reaction from Tilde in Tilemap tiles not colliding with sprite   
    I figured it out.
     
    I was using the vars that held the TilemapLayer objects as the 'layer' parameter in setCollision, since it does ask for a TilemapLayer as the layer parameter. What I derped on was the fact that I should have created the layers before I used setCollision.
     
    As a side note I found that using the actual name of the layer (as it appears in the tilemap data) as the parameter also works, which means the order no longer matters.
  24. Like
    Arcanorum reacted to Rafarel in Discuss about Phaser.Plugin development   
    Hello there!

    I'm totally new to your forum and it's my first post, here's a quick introduction about me:
    I'm a French developer who makes games in his free time like Claytus Tower Defense and who works on 360° video web technologies at my job (Kolor).
     
    I want to take part on Phaser development and Phaser Plugins development and I want to know how to do it well!
    I spent the last few days to watch every demo and read the documentation that Phaser provides, it looks to me to be a very good project and a strong knowledgeable team.
     
    I haven't found any "How to" or "Good practices guide" about Phaser.Plugin development and submitting.
     
    I wanted to start by providing a path finder plugin that works with a Phaser.Tilemap and a JSON file made with the Tiled Software.
    I ran through some "How the hell can I achieve this the proper way?" kinda questions
    Maybe you can confirm that I'm right or wrong doing on some points:
     
    Need more data from the JSON parser:
     
    In the process I needed to adapt the Phaser.TilemapParser.parseTiledJSON because I wanted to have the tileproperties on the layer object from the TiledJSON file. (made in Tiled software)
    These properties are omitted by the original function so I added this line to my override one:
    tileProperties: json.tilesets[0].tileproperties Maybe there's a better way to achieve this, but I didn't find it.
    I'd love to pass an additional data {'stringIndex', ... } arguments to game.load.tilemap for example:
    game.load.tilemap('desert', 'assets/maps/tilemap.json', null, Phaser.Tilemap.TILED_JSON, {'tileproperties'}); Adding a debug method:
     
    I wanted to output the calculated path by drawing a line on the screen, so on my plugin file, I added a function to the Debug prototype:
    Phaser.Utils.Debug.prototype.AStar = function(astar, color){    ... Drawing the last calculated path by astar plugin object ...} Here is a screenshot of my work in progress. (debug draw is the red line)
     

     
     
    I'll upload a live demo a soon as possible with a fun sandbox to test it
     
    Many thanks for sharing your work!
     
     
     
  25. Like
    Arcanorum reacted to lewster32 in Tile or Tilemap mouse events?   
    I think this is just for collisions, for input I think probably a combination of getting the pointer position when down and finding the appropriate tile via tilemap.getWorldXY.
     
    There's an example that shows how input can interact with a tilemap, however I think the way it does it is slightly outdated - it still works but it looks like getWorldXY was implemented to make this process easier: http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=paint+tiles.js&t=paint%20tiles