CorayThan

Members
  • Content Count

    11
  • Joined

  • Last visited

About CorayThan

  • Rank
    Member

Recent Profile Visitors

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

  1. Hey, I was wondering if anyone has a recommendation for creating a 2D online card game. I'm planning on using a canvas or webgl library for the game board. (Inside a React app.) I have experience with Phaser, but it also feels like that would be way overkill for what I'm looking for. I basically just need to draw images to screen, some drag 'n' drop, right click functionality. I don't need anything fancy or pretty. (This is going to be a client for a pre-existing card game, not something I will try to sell.) Maybe I should go the simple route and just use the straight up canvas?
  2. Thanks Nasimi! Unfortunately I can't get it to work in my project. I'm using Typescript and the "CustomMaterial" constructor doesn't resolve. Even when I tried ignoring the errors it apparently isn't a constructor: Uncaught TypeError: BABYLON.CustomMaterial is not a constructor I switched the playground to be the same version of Babylon I'm using too, so not sure what's going on there.
  3. I'm trying to create a 2D plane with the normal alpha of the PNG I'm applying to it as a texture. The PNG as a gradient. I can get the mesh plane to use alpha, but it makes the image into a solid block of color instead of using the normal alpha. How do I fix this so it uses the alpha gradient? https://www.babylonjs-playground.com/#1U5KWI
  4. In case anyone else comes across this, what I was looking for was to use ray casting and check what the ray from the camera to the mesh hits: Ray.CreateNewFromTo(cameraPosition, meshPosition) const picked = scene.pickWithRay(ray) return picked.hit
  5. Is there a simple way to check if a mesh is in the frustum and not hidden by other meshes? It seems pretty easy to check if the camera is aimed at the mesh in general: scene.isActiveMesh(mesh) But I want to check if the mesh is not hidden by other meshes. I'm creating a 3-D maze and need to move/lock the camera temporarily when certain objects hidden in the maze come into view. If I have to, I can determine a geometric area where if the free camera is in that area and the mesh is active it is visible, but I'd prefer to do it an easier / better way if possible.
  6. Ah, that fixes it, thanks! That's curious though that you aren't setting handCursor=true at all and you're getting the hand cursor. That isn't working for me. Also thanks for the advice about resetting the cursor. With this working I won't need that for now, but maybe later.
  7. I have a bunch of buttons I'm using, and with some of them I destroy or disable them after they are clicked. They also use a hand cursor on hover. When I destroy them, the game seems to reset to the pointer just fine, but when I disable the input and turn off the hand cursor, it seems to get stuck on the hand cursor for the entire canvas. So basically, if I have a sprite with this.button.input.useHandCursor = true Then in the onClick I set that to false, the hand cursor doesn't go away. Does anyone know a way to manually change the cursor, or fix it so it changes properly by itself? I've tried document.getElementById("game").style.cursor = "auto" where "game" is the div I'm setting the phaser game in, but that doesn't change anything.
  8. You're right that I was using the same number for diameter and radius. Later I tried removing the inner circle entirely, though, and just did a gradient from a center point, and had the same issue. Now I'm on a different computer and not having the same issue at all though ... maybe it is a browser-specific issue?
  9. I'm trying to create a radial gradient that starts from a point and grows from there, a little like smoke filling a room. I started with this example: https://phaser.io/examples/v2/bitmapdata/radial-gradient And have been slowly tweaking it to meet my needs. My current issue is that when my tween stops running the entire thing disappears. It's probably a really obvious issue, but I'm a newb and can't find it, so was hoping for help! Here's what I've got (it's in Typescript): in create: this.radGrad = this.game.make.bitmapData(800, 600); this.radGrad.addToWorld(); this.radCircle = new Phaser.Circle(200, 200, 0); this.outerCircle = new Phaser.Circle(200, 200, 300); this.smokeTween = this.game.add.tween(this.radCircle).to( { radius: 300 }, 20000, Phaser.Easing.Sinusoidal.Out, true); In update: const grd = this.radGrad.context.createRadialGradient(this.radCircle.x, this.radCircle.y, this.radCircle.radius, this.outerCircle.x, this.outerCircle.y, this.outerCircle.radius); grd.addColorStop(0, "rgba(0,0,0,0.3)"); grd.addColorStop(1, "transparent"); this.radGrad.cls(); this.radGrad.circle(this.outerCircle.x, this.outerCircle.y, this.outerCircle.radius, grd);
  10. I'm experiencing this same issue on 2.8.1
  11. I've got an issue with phaser and Typescript where my classes that extend Phaser classes aren't recognizing the Phaser class fields. I posted a pretty detailed stackoverflow question about it, but was wondering if anyone on here might have a suggestion. Feel free to reply here or there. Here's the details: https://stackoverflow.com/questions/45091893/cannot-access-base-class-properties-in-typescript/45100163#45100163