• Content Count

  • Joined

  • Last visited

Everything posted by DeusX

  1. I made a stationary and fast example right now and it seems to work, thanks. I will include that functionality in my game in the next days and will supply a solution to the problem here.
  2. Awesome, I'm gonna try that as well as soon as I have time.
  3. I can't test it right now but from what I understand this should work? Where 100 and 50 are the size of the sprite. And in my handler I keep my code(with addition of accounting for the things you listed) and work with the this.pixels array? let canvas =; let context = canvas.getContext("2d"); context.drawImage(this.sprite.texture.baseTexture.source, 0, 0, 100, 50 ); this.pixels = (context.getImageData(0, 0, 100, 50).data);
  4. I tried your solution with the grey frame around the texture and it works actually great, thanks.
  5. So, I checked it again and the problem was neither CORS nor the webgl context. First of all, I didn't really check the entire array because it was simply too large. I used the following to get the pixel values where I clicked. But this does only work if I don't resize the image. If I use e.g. this.sprite.width = 100, this.sprite.height = 50 it only logs zero. Is there a possibilty to adjust the size and keep the pixel values correct? this.sprite.on("pointerdown", () => { let px = Math.floor( - this.sprite.x); let py = Math.floor( - this.sprite.y); let index = (px+py * this.sprite.width) * 4; console.log([index]); )};
  6. So, your workaround is to just put a grey frame around the texture with gimp or something? Haven't thought of that yet lol, I will try that solution tomorrow and provide Feedback. Your general solution would be nice I think as this should be a rather common problem I suppose. I will take a look at your fiddle after trying the border solution. Thanks
  7. Hello, I'm currently working on a little game with and Island and some (right now static) water, I was looking online for water-effects and found this, simple Article I really like that effect but how do I restrict the area so that some of the image (especially the borders of the image, they look weird) stays uneffected, right now it looks a bit like wet paper instead of water. I tried using masking but that doesn't really help because now we have the same Image in the background but the edges of the foreground are still moving. Restricting filterArea and changing the padding doesn't really work also. My Goal right now is that the edges of the images stay static respectively uneffected by the filter. Thanks.
  8. I'm working on the first point, but I don't think this is the case here. btw, always returns false so I think there are no other contexts are created.
  9. So, I just set up a plain canvas and tried it with the ctx.getImageData(...) function, this returns the same Array with just all zeroes. Any Ideas why this is happening?
  10. I'm using the electron framework to create a desktop application
  11. Hello, I'm currently working on some small project with pixi but with more complex shapes. Now I wanted to look at the image data of my sprites but the pixel values are all 0. I searched on google and a few suggestions were that the renderer hasn't rendered anything yet or that the sprites weren't loaded, but this is not the case because if I take another sprite (the cat from my program suddenly works (I get an array with more than just all 0). Does this have something to do with my images? They are just .png files with a transparent background. let Application = PIXI.Application; let loader = PIXI.loader; = new Application({width: 556, height: 556}); = null; document.body.appendChild(; loader .add("sprites/cat.png") .load((loader, resources) => { = new PIXI.Sprite(PIXI.loader.resources["sprites/cat.png"].texture); = 100; = 100; = 0.5; = 0.5;; console.log(; => this.mainLoop(delta)); }); //this works fine, but if I take something else than the cat.png it doesn't work anymore Thanks
  12. Hello, I know this is my second Thread today but I found out about this forum today and I'm curious about the Problems I had while learning Phaser the past week, so sorry for that^^ My first game was a simple point&click game, where you could click an (moving) image & that image would appear somewhere new at random. Now the problem is that everytime I restart the scene (using this.scene.restart()) the object would start to stutter in the "new" Scene. The object always started in a random location and moved with moveTo(endX, endY, 100) to the other location. Is this because of the moveTo function? Should I use another approach for moving the object? I can supply a code sample later on. //startLocations and endLocations are Arrays containing random positions where the object should start and where it should go to create() { this.player = this.physics.add.sprite(this.startLocationsX.pop(), this.startLocationsY.pop(), "coin"); this.player.setCollideWorldBounds(true); this.player.setBounce(1); this.angle = this.physics.moveTo(this.player, this.endLocationsX.pop(), this.endLocationsX.pop(), 200); } //my config const config = { type: Phaser.AUTO, width: window.innerWidth, height: window.innerHeight, fps: 60, scene : [Game], physics: { default: 'arcade', arcade: { gravity: { y: 0 }, } }, } //and a reset function for when to object was clicked reset() { this.scene.restart(); } Thanks
  13. thanks to both of you, that solved my problem
  14. Hello, I'm new to Phaser and currently playing with/learning phaser 3, I wrote a simple clicker game, where you just click on an object as long as you want and you will get Points for it. Pretty easy so far, but now I want clicks on the background to do something else. this.cookie = this.physics.add.sprite(400, 400, "cookie"); this.cookie.setInteractive(); this.handleObjectInput(this); handleObjectInput(context) { this.input.on('gameobjectup',(pointer, gameObject) => { //do stuff with the clicks on the cookie }); } In my update function I call a function that checks wether the background has been clicked handleInput() { if(this.input.activePointer.justDown) { //do stuff unrelated to the cookie } } But now my Problem is that every time I click on the cookie, the handle Input function is called as well, which it shouldn't. I want the cookie sprite and the background to be two different "entitys". I tried assigning an eventhandler to the background as well but then a click on the background gets also registered on the cookie. Thanks.