• Content Count

  • Joined

  • Last visited

About Sturb

  • Rank
    Advanced Member
  • Birthday 08/24/1987

Profile Information

  • Gender
  • Location
  • Interests
    Developing and playing games.

Recent Profile Visitors

1238 profile views
  1. Hi, I'm building a live editing/debugging plugin for my Phaser games. I want this plugin to have keyboard shortcuts to toggle (wake/sleep) the plugin's GUI scene and other editing/debugging stuff. The problem I'm running into is that it seems each scene that's loaded has its own instance of an InputPlugin. This is making it difficult to wire up "global" keyboard controls for my plugin when my games switch and shutdown scenes, which results in the keyboard events being dumped. I do have a separate scene that my plugin overlays my game scenes, however my plugin scene can be toggled by using wake and sleep. When my plugin scene is asleep its InputPlugin doesn't receive key events because it isn't being updated. InputManager found on the game instance within the plugin on the other hand seems to only handle pointer events. I was wondering if there is a way to have a "global" InputPlugin instance that my own plugin can use that isn't tied to a scene. I would like to use the wake/sleep functionality of the SceneManager to be able to toggle my plugin GUI scene without blocking keyboard input.
  2. You could set fixedToCamera to false, and just set your 'customcursor' position to the input's world position by using 'game.input.worldX' and game.input.worldY'. This way you don't need to worry about taking any camera offsets into account because the world position of input already does that for you.
  3. You could have a boolean to determine the state of the door (open/closed) then do something like: function clickSprite() { console.log("clickSprite"); isOpen = !isOpen; sprite.angle = isOpen ? 90 : 0; }
  4. If you're using Arcade physics you could use: update() { game.physics.arcade.overlap(groupA, groupB, onOverlap); } onOverlap(thing1, thing2) { // Do things! }
  5. You could get the pixel color from your map under the center of your car. Compare that pixel color with the color of the edge of your road to detect if you're colliding with it. It might be easier if you had a black and white image that you use just for collision checks. Have the roads be drawn in black and detect collision with white pixels.
  6. Whenever your software trims the white space, the original dimensions are recorded along with the difference between the origin and trimmed dimensions. When imported into Phaser, Phaser will create a texture the size of the original sprite, and offset the trimmed image by the difference within the dimensions of the original.
  7. So I'm trying to flood fill a specific area on my bitmap data so I can create a mask for that area, however after setting the array data of the bitmap data nothing is showing up. I'm iterating over the length of array and setting rgba values as such:[i] = 0;[i + 1] = 0;[i + 2] = 0;[i + 3] = 255; I then proceed to draw my "buffer" bitmap data into my mask bitmap data as such: this.maskData.draw(this.bufferData, 0, 0, this.bufferData.width, this.bufferData.height, "destination-out"); this.maskData.update(); I've tried calling update() on my bufferData before drawing it into the maskData, however it didn't help.
  8. @kaasis You won't be able to encrypt your Javascript code. You can only go as far as uglifying and minifying it. Javascript isn't a compiled language. It lives and executes on the page that loads it. That's just how it works. You will always be able to get any Javascript that is running on a web page by inspecting, there is no real way to hide it, which is why we uglifying/minifying it. As mentioned in the above posts, this will slow down people trying to make sense of your game code, however if someone is dedicated enough, they might be able to make sense of it (however that would take a ton of time and dedication to do). Jammy provides some links that will help.
  9. Sturb

    Arcade body flicker

    Yea I tried calling callAllExists("preUpdate", true) on the nested groups after I shuffled and positioned the layouts with no luck. I then tired calling preUpdate on each sprite as I respawned them in their nested group, which also had no effect. It's unfortunate, but my solution is to just manage nine groups instead of just three. It doesn't really effect performance, just doesn't allow me to structure my levels as nice as I would like lol. Perhaps this is a bug? Forcing a preUpdate call kind of feels like a hack. I mean it works and all, and I'm greatful for that, it just feels weird lol.
  10. Sturb

    Arcade body flicker

    Awesome! Thanks for that. It appears though that it doesn't work for nested groups, which is how my project is set up. The chunk is the parent group that moves, which has children groups for different object types. Calling preUpdate on those nested groups didn't seem to have any effect, however if I add my objects directly to the chunk and call preUpdate on that, it works. This isn't ideal because I want to handle collision differently for each of the nested groups (tiles, collectables, obstacles, etc).
  11. Hey guys! I'm having another issue with my endless runner and arcade physics bodies. This time bodies seem to flicker for a frame after I have call kill/reset on their sprites. Basically I have three chunks which are laid out and scrolled on screen one other the other. Once a chunk has scrolled off the opposite side of the screen, the layout is reshuffled and it is positioned behind the previous chunks so it can scroll back on screen. Before reshuffling the layout, I forEachAlive -> member.kill(). This is because it's possible that no every child of the chunk will be used in the new layout, so I want to pool them. When I generate the new layout, I reset(x, y) the child. This seems to cause the body of the child to flicker on screen despite the chunk being off screen. I wrote an example and attached it to help demonstrate the issue I am having.
  12. Sturb

    Arcade Physics bug?

    Setting 'body.moves = false' has seemed to fix my issue. I didn't have to change 'arcade.collide' to overlap, however I'll keep that in mind if anything else comes up. Thanks a lot samme!
  13. Sturb

    Arcade Physics bug?

    I was wondering if that was possibly happening. If that's the case then I would be confused as to why I'm getting a collision event when I would expect one. That would indicate to me that the bodies are indeed moving.
  14. Sturb

    Arcade Physics bug?

    Hmm.. body.touching on both my player and the object are also all false (none: true) at the time of collision. Does Phaser's Arcade physics not like it when you manually set position of the object instead of applying a velocity to it?
  15. Hey guys! I'm making an endless runner and I'm running into a weird issue with Arcade physics. Because my game is an endless running, I'm anchoring my player on the screen and moving the objects towards the player instead of using the camera. My issue is that I get collision events however none of the body.blocked booleans are being set, so I know a collision happens, but I don't know which side it happens on (up, down, or left). I'm checking for collision like such:, this.chunks[0], levelHandler, null, ctx);, this.chunks[1], levelHandler, null, ctx);, this.chunks[2], levelHandler, null, ctx); Basically, what I'm doing is I spawn three chunks (or segments) of objects and position them one screen length apart from each other. I then scroll each group on screen towards the player. When a chunk is scrolled off the opposite side of the screen, I reposition it back behind the last chunk in the list so it can be scrolled back on towards the player. My 'levelHandler' is being called properly, and it's giving my the object that the player collided with. Again, my issue is the object.body.blocked booleans aren't being set, so I don't know whether the player hit the left side, top, or bottom of the object. Would this be because I'm not moving the objects by applying a velocity to the object's body? I'm moving the parent group of the objects so I don't have to iterate through all my objects to do that. Is there another way to get the information I want? Or am I going to have to write my own detection to get which side was hit after the collision happened?