s4m_ur4i

Members
  • Content Count

    139
  • Joined

  • Last visited

About s4m_ur4i

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    instagram.com/s4m_ur4i
  • Twitter
    s4m_ur4i

Profile Information

  • Gender
    Male
  • Location
    WA, Australia

Recent Profile Visitors

1,607 profile views
  1. s4m_ur4i

    Exclude graphics from Camera Shake

    Personally, I found that using multiple scenes is a lot more comfortable for many things, like UI elements etc. because it can get messy if your game gets bigger. It kind of sorts it. And also is not affected by the camera of the other screen - as Rich already pointed out. The only thing is, that you have to get sure the new scene (if your game is bigger than the view) is aligned with the underlying scene.
  2. s4m_ur4i

    How to align game in webpage

    add "rel=stylesheet" to your <link> element. Get sure that the path to your CSS-File is correct. The CSS seems not to be loaded as of the background of the text-boxes should be black. also: I think you need to give your canvas an ID and put it in the phaser game config, not sure about that, since I never used it that way. Maybe someone else can clarify. and add this to your CSS to get rid of browser defaults * { margin: 0; padding: 0; outline: none; text-decoration: none; border: 0; }
  3. s4m_ur4i

    How to tween scale in Phaser 3

    this.scene.tweens.add({ targets : this , scale : 10 ease : 'Linear', duration : 500, }); You can simplify it. targets only needs to be an array if it's multiple targets. scale: 10 does both X&Y yoyo default is false, as 0 of repeat and callbackScope is this.
  4. After digging through the documentation: I think this is not intended behavior. At least, if you have a game were the camera zoom out and in because of multiplayer or having an action platformer, there is no way to fix any sprite to the camera's view. If a sprite is set with sprite.setScrollFactor(0) it should be kept in view when the sprite's position is initially in view. Even if the camera is zoomed.Zoom is an option on the game config, and useful in a lot of cases to have your game with a base zoom. Rather than taking the scrollX and scrollY of the camera, which are minus values by zoom > 1, setScrollFactor should align to the worldview. Or at least it would be helpful to have a value that can be set to be fixed on zoom. Because, as far as I am aware, there is nothing to calculate the offset of the current zoom right now. solution: use a second scene for UI stuff, or alignment
  5. I am on WebGL mode, with a camera.zoom(7) and put some sprites to setScrollFactor(0) they disappear. So I had a look at the camera, in the top left corner of the game, it has a .scrollX/Y of high minus values. I already recalculated the world bounds and camera bounds, but that won't help. For me, this seems like a bug right now, but maybe I am again just missing something. I also noticed that the: this.camera.main.worldView.width // also height Is not set correctly, it is set some milliseconds after create is initiated, but if I log it directly in create it just holds the whole window width in pixels, not the zoomed calculation. Can someone else have a look at this? It's reproducible as far as I can see. Thanks in advance EDIT: as I see, this intended behavior, not a bug: setZoom( [value]) Set the zoom value of the Camera. Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. Changing to a larger value, such as 2, will cause the camera to 'zoom in'. A value of 1 means 'no zoom' and is the default. Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. https://photonstorm.github.io/phaser3-docs/Phaser.Cameras.Scene2D.Camera.html#setZoom__anchor But is there a way to get scrollFactor to work with a zoom? Reason: I got a camera permanently on zoom, which needs some UI displayed.
  6. So I assume it's the same for phaser3. Don't really get why. Because you would want to check an overlap with all the Tiles that are existing in that layer. Or not? Nonetheless. For me, this question is answered. thanks samme
  7. A collider collides only with set tiles on a tilemap. However, if you are using an overlap with a tilemap, it always callbacks. If you log the index of the Tile, it's 0. So "no set tile". Is that intended behavior?
  8. s4m_ur4i

    How to align game in webpage

    link the css file in your HTML head <head> <link href="style.css" type="text/css"> </head> <body> <div class="wrp"> <section class="text-one">some text</section> <canvas></canvas> <section class="text-two">some text</section> </div> </body> ** your css file .wrp { display: block; width: 800px; margin: 0 auto; } canvas { display: block; width: 800px; height: 600px; } .text-one, .text-two { display: block; height: 40px; background: #000; color: #fff; padding: 10px; } cheers
  9. I found the issue, but this makes me even more confused. //IN a scene this is called: this.physics.add.overlap(this.config.player, this.config.layers.water, this.config.player.collideWater, null, this.config.player); It is an overlap with some layer and stuff. It has nothing to do with the issued sprite code above. But it involves the player sprite (which the above sprite should collide with). If I out-comment this line, the colliders will work again. But since I need the overlap AND the collision check I can't, and this does not seem like it should behave like that? It even gets more confusing: When I add the overlap or collision in the player class itself. It won't collide with other elements anymore that were not affected to this issue before.
  10. update: It still does not work but when I enable the collision from "The other sprite" (the sprite it should collide with), it works. same code. this makes no sense to me, has anyone a clue why this occurs? It's not practical for me, enabling the collisions that way.
  11. If someone has a Tip for what I could look, I would be grateful. I am right now building the game back to just a boilerplate because I can't figure out, why the collision is not working but the callback does. it is not that the collider isn't added. it works, and both sprites have bodies enabled, but the Player just falls through it. Any ideas would be helpful
  12. @rich There was this.scene.add.existing(this); in the player class. But when I remove it, the player can't receive any animations? Am I missing something? class Player extends Phaser.GameObjects.Sprite { constructor(config) { super(config.scene, config.x, config.y, 'player', 0); this.scene.physics.world.enable(this); this.setAlpha(1) .setOrigin(0.5) this.body .setCollideWorldBounds(true) .setSize(5, 14, false) .setOffset(8, 10) .setBounce(0, 0.3) .setMaxVelocity(480, 600) } } Calling the new Player({scene: this, x: x, y: y}); with "this.scene.ad.existing()" - enables animations. But "this.displayList.add(" does not. cheers
  13. Ah yeah I will have a look. That makes sense. Thank you!
  14. class ObjectFactory extends Phaser.Plugins.BasePlugin { constructor(pluginManager) { super(pluginManager); pluginManager.registerGameObject('player', this.createPlayer); pluginManager.registerGameObject('overlay', this.createOverlay); } createPlayer(x, y) { console.log(this.displayList.add(new Player({ scene: this.scene, x: x, y: y }));) // <= returns null //return this.displayList.add(new Player({ scene: this.scene, x: x, y: y })); } createOverlay(x, y, w, h) { return this.displayList.add(new Overlay({ scene: this.scene, x: x, y: y, w: w, h: h })); } } I think it's because this.displayList.add(...) does not return a value ? (I am guessing), because it's even at that position, that I don't get a context. even tho, the player is created. Edit: If I call just call the player by: this.player = new Player(this, x, y) <- it works. But not when calling in the factory class