windyWin

Members
  • Content Count

    2
  • Joined

  • Last visited

About windyWin

  • Rank
    Newbie

Recent Profile Visitors

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

  1. Hello there, I'm working on 2d collision and stumbled across the overlap function. I'm having trouble with something simple. I have an player entity and an npc entity with a physicsGroup set as a collision circle. As the player touches the circle, I want the npc entity to interact in some way. (say, shoots bullets at the player) I can easily listen to any collisions and trigger a boolean to true.. .. but am struggling to find a way to trigger to turn on or off depending on whether the player entity touches the collision circle. For example: Sends a log to console "collided" if player collides. If player doesnt collide, send a log to console "not colliding". Heres my entity code: export const createEntity = (scene) => { entitySprite = scene.add.sprite(487, 249, '') entityPhysicsGroup = scene.physics.add.group({}) entityPhysicsGroup.add(entitySprite) circleShape = scene.add.circle(0, 0, 0, "0xfb00", 0.3) circlePhysicsGroup = scene.physics.add.group({}) circlePhysicsGroup.add(circleShape) circleShape.body.setCircle(128, -128, -128) isTouching = false scene.physics.add.overlap(circleShape, playerSprite, (e) => { isTouching = true }) } I've tried declaring the boolean as false both globally and in the createEntity function. I've also tried this in the updateEntity function that I have. I personally would have thought that a second callback could be used to trigger a function if the player entity stops overlapping with the circle, or just something in general that listens when things are not touching. The boolean method may work but my logic used to implement it might be a little fuzzy. Any thoughts and help would be much appreciated. From a phaser 3 newbie.
  2. Hello there, I'm currently learning Phaser 3 and enjoy the use of it. I'm working on UI with a left and right arrow for each column. That column could include a list of items, and should be able to scroll through at the click of an arrow. I've made an attempt using an array that holds the list of strings, and have a variable increment the index by 1. Example like below: // Hair // < Red > I made a TextButton class which works fine. I initialized them in the update method. The problem is that I dont give it any time to kill the previous string that was displayed, so while scrollable, it just prints the next string on top of the other. I'd appreciate any pointers on perhaps a better process to handle this using Phaser 3, I'm a little new to this library. Thanks.