NoxBrutalis

Members
  • Content count

    50
  • Joined

  • Last visited

About NoxBrutalis

  • Rank
    Advanced Member

Recent Profile Visitors

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

  1. NoxBrutalis

    Not rotating from sprite origin

    yeah, rotating things in tiled is a bad idea normally. As it doesn't translate very well. I had the same problem with walls in my map. I had thought i could could copy sections of my map in tiled, and rotate them for faster map making, but in phaser they came out all wrong. Instead of changing your cars origin to 0,0 to get it where you want, you should figure out the offset from it's intended position. so for example in your picture above where you didnt change the origin to 0,0 and it's in the wrong place, add half the width and half the height to the x and y positions and it should be where you want it to be.
  2. NoxBrutalis

    Game Objects not being destroyed

    you could also do: yourGroup.remove(object, true true); the remove has too bool params one to remove from scene, one to destroy. Glad you got it working
  3. NoxBrutalis

    Creating basic lighting system

    Okay, so an additive blend mode is one where the colour that you're adding to an image is added to the existing colour, whereas a multiplicative blend multiplies it. So the problem is that your light cone is transparent, not white. if your scene had a layer of darkness separate from the lightcone image, and your lightcone image used white, then you could use additive blending and the white from your light would be added to the darkness beneath, negating it. So you light cone should be white, or a light yellow or something, surrounded by transparency. Does that make sense? here's a link to a phaser blog about custom blend modes. I don't know if this stuff is working or not, but could be worth a shot, and at least hopefully you get what I mean now, though feel free to ask more questions. Sorry it took me so long to get back to you btw 😕 https://phaser.io/phaser3/devlog/92
  4. NoxBrutalis

    game variable unidentified inside create function

    Oh that's sweetly concise, Rich
  5. NoxBrutalis

    Creating basic lighting system

    As far as I can tell, the lights aren't working in phaser 3, well, I tried to make one and it wasn't working. On a side note though, the docs only list a point light, type of light, so I don't think you would be able to have a cone/torch like you have in the pic even if it does work. I had a look because I've used glsl - open gl shader language before, and lighting is the kind of thing you can implement in shaders, but the example for the effects layer - Phaser's way into gl shader land, isn't working so it's probably best that you stick to your current approach. In regards to that, is there a way you can have the server keep track of the position, origin and rotation, or something like that, and pass that to the clients when they're in range of each other to see? Basically the same as you're doing, with a couple more data. Otherwise, what problem do you see arising from the multiple lights - that it's too intensive? the rotation would just be the same as the players, the position would be a small offset value of the player's position, and the origin would possibly be the same on all your player torches, so you could assume, it will be 0, 0, or centre, which means you don't even have to track the info, it's all possible to work out from the player that owns the torch. Maybe a bool to say whether it's switched on or not.
  6. NoxBrutalis

    game variable unidentified inside create function

    or this seems more proper as the ondown callbacks all say they aren't really for general purpose input. This is the other thing i mentioned, not much info there tho: https://photonstorm.github.io/phaser3-docs/Phaser.Events.EventEmitter.html#emit I think this is how you can emit custom events, but i dont know how it's set up.
  7. NoxBrutalis

    game variable unidentified inside create function

    //put this in create this.keyBools = { up: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W), down: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S), left: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A), right: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D), shift: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SHIFT), pause: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ESC) } //in update if(this.keyBools.up.isDown) { // do the things } you don't have to put them in an object, but's neater. -- edit: sorry, I realise that isn't helpful, you don't want to poll i take it. try and find emit in the docs. or maybe this is the thing - https://photonstorm.github.io/phaser3-docs/Phaser.Input.InputManager.html#addDownCallback
  8. NoxBrutalis

    preventing zoom on some objects

    Yeah, if you're talking about your UI elements then, use a different scene is your best bet.
  9. NoxBrutalis

    Sounds keep looping after changing scene

    Last time I checked, animations remain and so when restarting scenes you often get warnings saying they're already defined. At the minute for the main file of my game, I have a separate initialise functions, that resets things manually, but I know a lot of people - including Rich, the main dev, use a separate scene for animations and various other assets. This is in part because they can use the scene as a splash screen to load things in a more seamless manner I think, but it has the added benefits, such as no warnings, and the ability to restart and swap scenes without the issues you're worried about. I've not read through this myself, so sorry if it's not the same thing, but I think it is https://phaser.io/news/2018/05/phaser-3-preloader-tutorial Otherwise, I can't offer any more advise, alot of the things you mentioned, I'm not sure about. I think the scene changing etc is a bit sketchy. It's still fairly early days for phaser 3 at the minute.
  10. NoxBrutalis

    Phaser as Multiplayer Server

    Indeed, your back end should be dealing in game abstractions rather than phaser data types etc. It would also be very bad for efficiency having those data types passed back and forth between the client, when simple numbers and strings could do. It's a lot like creating save game files and serializing data in that sense. When you save a game, you don't save all the objects and state and literally everything - you save simple data types that act as signposts for rebuilding your types/objects/state etc.
  11. NoxBrutalis

    Different depth of one layer's tiles

    Yes, you need to make a dynamic layer I believe. Dynamic layers, rather than static layers are for tile that you wish to modify during the game. here's a link to the docs on it: https://photonstorm.github.io/phaser3-docs/Phaser.Tilemaps.DynamicTilemapLayer.html
  12. NoxBrutalis

    Sounds keep looping after changing scene

    It's the right one now. A mod must've moved this over into the correct place, you were in the bit where people share projects and plugins and things. What I do in my current game, is I have a seperate scene called the audio manager, that way the background music and sounds are not linked to the scenes changing during gameplay as such. Its the same concept as a preload scene. You may already know, but in phaser 3 you can have many scenes, but also ones that run at the same time.
  13. NoxBrutalis

    SOLVED issue with world bounds collision

    SOLVED AT LAST Im an idiot really as I think I read a post about this recently, but Im guessing a group is considered a container? I saw someone say that containers wipe set data from gameobjects when you add them to the container. This is definitely the case with group, though I'm wondering if this is expected behaviour? Im not sure as many people would spot it, as most people seem to have their players as standalone, but in my project the player is in a group with other friendly a.i sprites. So basically, if you add a sprite to a group after having set : this.player.setCollideWorldBounds(true); this.player.onWorldBounds = true; then its as if you never set it. So you either have to set them to true again, or set them to true after adding them to the group. There's possibly a way to set such properties on the group as a whole, but I don't know it. Anyways, so if your world bounds aren't working, check the order in which you initialise some of these properties in relation to when you add the sprite to a group etc.
  14. NoxBrutalis

    Animation oncomplete callback

    In the example you quoted, the name of the animation is being concatenated to the end of a user defined event. It's Samme's way of making ti so he only get's events when it's a specific animation. I didn't know you could do that actually, hence the like
  15. NoxBrutalis

    Custom Tile Collision Width

    Just a quick update, sorry to bump, but further to the above, I realised that the built-in tilemap collider is way more efficient, ofc it only depends on the size of your map, mine is 10k tiles, so pretty big. So i counted up the collision tiles and I had 1768 collision tiles, and it was noticeable because lag. So I optimised further. I found out that using the tiled object layer, although tedious, allows for more simple data loading. I went back into my tiled map, and added another object layer for collision tiles, and instead of having one per tile, I made all the walls into long tiles etc and loaded them. I went from 1768 collision tiles, to 850 something... Here's a pic: and this is how I extract the data I need to remake the colliders how they are in Tiled. Best avoid rotation, I had to redo half my map because lazily rotating selections in Tiled resulted in unusable collision tiles 😕 this.map.objects[1].objects.forEach(ele=>{ var wall = this.physics.add.sprite(ele.x, ele.y, null, null).setVisible(false).setActive(true).setOrigin(0, 0); wall.body.setOffset(16, 16); wall.body.width = ele.width; wall.body.height = ele.height; wall.body.immovable = true; this.wallGrp.add(wall); });