Jump to content

Sturb

Members
  • Content Count

    38
  • Joined

  • Last visited

About Sturb

  • Rank
    Advanced Member
  • Birthday 08/24/1987

Profile Information

  • Gender
    Male
  • Location
    Canada
  • Interests
    Developing and playing games.

Recent Profile Visitors

1445 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
  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! } https://phaser.io/docs/2.6.2/Phaser.Physics.Arcade.html#overlap
  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: this.bufferData.data[i] = 0; this.bufferData.data[i + 1] = 0; this.bufferData.data[i + 2] = 0; this.bufferData.data[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.maskD
  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
  9. 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 l
  10. 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,
  12. 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. 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. 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.game.physics.arcade.collide(sprite, this.chunks[0], levelHandler, null, ctx); this.game.physics.arcade.collide(sprite,
×
×
  • Create New...