Zackorz

Members
  • Content count

    36
  • Joined

  • Last visited

  1. Parents, Childs and "Scale.To"

    I have a "parent sprite" and created a "child sprite". I scaled my parent down, because i want it to look fine when somebody have a higher resolution and scale the game "up". Example code: var exampleParent = this.add.sprite(this.world.centerX, this.world.centerY-400, "parent"); exampleParent.scale.setTo (0.5, 0.5); var exampleChild = exampleParent.addChild(this.make.sprite(-100, -40, "child")); I get a really strange behaviour now. The "child sprite" isnt really scaled down. When i do a "overlap-test", or check the "sprite.width" in the console, its has its original size. But the "Childsprite" is displayed by thehalf of its size... Thats really weird, any tips what i can do to display it at its correct size?
  2. "Overlap" Collision without transparent areas

    I attached now a smaller sprite as a child to the graphic, but it is not a perfect solution, because my graphic is rotating and the animations also. I always have to shift my sprite, or create an sprite with animations, so it fits with the animations on my object. Is there a better solution? A way to ignore transpareny in the "overlap" would be great.
  3. I have images with transparent parts. Is it possible to use the "overlap" function and just trigger it when the visible parts touch each other? So it wont trigger when transparent parts lay over each other. The "P2" collsion detection doesnt work for my game, because im using "tweens" and the physics destroy my movement.
  4. flickering edges

    My game ist working fine so far, and the performance is good. But the half of the time i have these "flickering /moving edges" everywhere. This is only happening on my "tablet" (android), not on the PC. In the "start menue" this is only happening while the game is loading, after that the picture is ok. When the game is started the "edge flickering" is happening half of the time. This happending to static pictures like the background and also to animations. Somebody know what that could be? Its hard to post alle the code ( my code is also a bit messy, because i hadnt the time to structure it), so maybe you can tell me what part do you need.
  5. tween.onComplete delete the correct sprite

    Any idea, how i can get the sprite name that completed his movement? It would also help, if there would be a check that tells me if a sprite is moving.
  6. I use tweens for my movement of sprite objects. These sprites are generated randomly and getting pushed into an array. When the sprite movement has finnished, i want to destroy them and removed also their position in the array. Im trying to do it with the "onComplete" function but i dont know how i can figure out which sprite has finished his movement and can be deleted. Is it possible to get some feedback from "onComplete" that tells me which sprite has "completed" his movement ?
  7. collision detection

    Ok thanks, i will give it a try :-)
  8. "Phaser.Arcade" Collision

    I tried it with "overlap" instead of "collision" now and it works. I dont get it why "collision" doesnt.. what is the difference between this two and why is only "overlap" working?: this.physics.arcade.collide(bird, cloud, collisionHandler, null, this); // not working this.physics.arcade.overlap(bird, cloud, collisionHandler, null, this); // working function collisionHandler (obj1, obj2) { console.log("collision detected"); }
  9. "Phaser.Arcade" Collision

    Didnt i checked for that? I placed the sprites on the same position, and checked for a collision. But i always get "false" (and they should collide all the time when they at the same position). i also tried : this.physics.arcade.collide(cloud6, cloud5, collisionHandler, null, this); function collisionHandler() { console.log("collision detected"); } But its always "false" and the collisionHandler never fires. Do i have to write it in another notation? Thanks for informing me about that, but its correct in game, I just translated it for this forum and forgot to translate everything.
  10. "Phaser.Arcade" Collision

    Im sorry for opening a new thread, but my old is kind of messy and i really, really need some help fast. I need to finish a prototype for presenting a project but cant figure out how i get my collision detection to work. Here is an example how i programmed my code. Create: cloud1 = this.add.sprite(this.world.centerX, this.world.centerY/1.5, "cloud"); wolke2 = this.add.sprite(this.world.centerX, this.world.centerY/1.5, "cloud"); this.physics.startSystem(Phaser.Physics.ARCADE); this.physics.enable(cloud1, Phaser.Physics.ARCADE); this.physics.enable(cloud2, Phaser.Physics.ARCADE); Update: console.log(this.physics.arcade.collide(cloud1, cloud2)); I also get "false" as a result of my collision. What is missing? I love phaser, but the never had half of the trouble with collision detection in any other framework..
  11. collision detection

    i added: this.physics.p2.enable(bird, false); now its working, but this line destroys all movement of my bird. I have a "tween" movement on my bird, that is triggered when i click somewhere. Why is this gone now??? The rest of my game is also broken , both physics objects are flying around like crazy now..
  12. collision detection

    Ok thanks. I tried it with " P2JS" now, but i cant figure out what im doing wrong. Here is my code: create: this.physics.startSystem(Phaser.Physics.P2JS); this.physics.p2.setImpactEvents(true); this.physics.p2.restitution = 0.8; var playerCollisionGroup = this.physics.p2.createCollisionGroup(); var cloudCollisionGroup = this.physics.p2.createCollisionGroup(); this.physics.p2.updateBoundsCollisionGroup(); var clouds = this.add.group(); clouds.enableBody = true; clouds.physicsBodyType = Phaser.Physics.P2JS; var smallcloud= clouds.create(300, 300, 'Cloudpicture'); smallcloud.body.setRectangle(40, 40); smallcloud.body.setCollisionGroup(cloudsCollisionGroup); bird = this.add.sprite(this.world.centerX, this.world.centerY/1.5, "mysprite"); bird.anchor.setTo(0.5, 0.5); bird.enableBody = true; bird.physicsBodyType = Phaser.Physics.P2JS; bird.body.setCollisionGroup(playerCollisionGroup); // here i get an error: "cannot read property CollisionGroup of null" What is wrong with this line ? I think i programmed it like in the phaser "group collision example"
  13. collision detection

    hello guys, Im trying to implement collision detection to my game, // i Activate the physics system in my "create" function: myGame.physics.startSystem(Phaser.Physics.P2JS); myGame.physics.p2.setImpactEvents(true); // Now im defining the "colliding" objects in my "update" function: if (myGame.physics.arcade.collide(collider1, collidor2)) { console.log("collision"); } What is missing/ what im doing wrong? I never get any collision feedback, when the objects touch each other.
  14. best methode to move and spin an image

    Still no linear movement. Im doing something wrong, but i cant figure out what it is. This is my code: var demotweeen = this.add.tween(mytween.to({x:400,y:400},500, 'Linear'); demotweeen.start(); Ok i got my error, i used it in a loop. Therefore the way was recalculated new every loop and it takes 500 ms every time new. "Linear" is working now, thanks.
  15. Hi, I want to move some objects ( i spawn one every 2 seconds) to a specific point and spin them, so the front of the image should be always pointing towards the goal destination. I wonder what method is the best here. I started using a "tween", but i didnt like the smooth movement, i want it to be linear. Also i didnt know how to spin the image into the correct position.