Bavragor

Members

22

• Rank
Member

Recent Profile Visitors

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

1. Boomerang effect

Thanks to the both of you, Llorx and BliantFive. I'll idd start using gravity/force instead of trying to arc the ball's movement manually!
2. Boomerang effect

I might try replacing the physics I'm using with tweens. Should see how that works out. And it the meantime try to implement the example you've given me. Thanks!
3. Boomerang effect

Is it better to use tweens than actual physics? Because so far I was using the P2 physics and changing the velocities, etc etc. Guess you can't do any colliding/bouncing etc with tweens?
4. Boomerang effect

For example the image below. The "full" circle is supposed to be shot at the "semi-full" circle in an arc. The bent line in this case showing the arc it should make. So the looping back on yourself isn't really necessary, gravity ain't necessary either.
5. Boomerang effect

Hi, I'm trying to replicate some sort of boomerang effect on an moving object. In short I'm shooting away a sprite but instead of shooting the sprite away in a straight line, I'd like it to move in an 'arc'. Regrettably I have no idea how to achieve this sort of movement. If someone could explain me the theory around such movements, that would be awesome. If you could include a code example, you'd be my hero (of the day). P.S. I'm using P2 physics. Thanks in advance.
6. P2 equivalent of Arcade velocityFromRotation

HI memgut, Thanks for your answer, but it was not exactly what I was looking for. I got where I wanted to be in the end by calculating the angle between two points and using that angle to define the velocity x and y. Thanks anyhow
7. P2 equivalent of Arcade velocityFromRotation

The title is pretty self explanatory. Is there any method, in P2 physics, that has the same effect as the velocityFromRotation method in Arcade physics? If there ain't any equivalent, is there a different way to solve this "problem". Thanks in advance!
8. Sprite.rotation

Thanks to the both of you! AzraelTycka for the theory behind it and Tom Atom for the actual function! The Phaser.Math.angleBetween function did the trick. If you were wondering for the actual line of code: this.aimingLine.rotation = Phaser.Math.angleBetween(this.ptr.x, this.ptr.y, this.game.input.activePointer.x, this.game.input.activePointer.y) - 3.14; With ptr being the position where the player started dragging.
9. Sprite.rotation

Hi, The post title might be a bit of a misleading one as I do not have a real problem with the code itself, but the thinking process around it. What I'm trying to accomplish is the following: aiming and shooting an object based on drag distance and drag direction, etc. When dragging the mouse I want a line to appear into the direction the object is going to be shot. I have no problem with making the line appear, shooting the object etc, but I do have a problem with the correct direction. I've been trying to accomplish what I want with the rotation property, but I'm getting nowhere I want to get at. I totally suck at explaining what I'm trying to accomplish, but the best example is the app (game) bbtan in which the aiming functionality is exactly as I'm trying to accomplish, except for the fact I want to be able to aim downwards too. In the following youtube video you can watch some gameplay of the bbtan game. https://www.youtube.com/watch?v=WISOyBzd9J0 p.s.: I'm not trying to make a copy of bbtan, yet their aiming method is what I need.

11. Sprite movement too quick for timer event to capture

@drhayes Never mind about what I said in my previous post, you we're right. The code I wrote there wasn't 'correct'. I've changed it now. Thanks for the help.
12. Sprite movement too quick for timer event to capture

You can 't use this.collides(this.shootingCircle, this.targetCircle). Getting an error with 'callback...', can't recall properly, but have had extensive problems with it. Mainly you can't call a function that needs arguments inside the loop. If this.collides() would have been an option it would have worked. That aside could it be that the code I'm executing in this.collides(a, b ) requires too much time. Aka if I could simplify that code, it might work?
13. Sprite movement too quick for timer event to capture

Could I solve this problem by using the P2 Physics instead of the Arcade Physics?
14. Sprite movement too quick for timer event to capture

I understand the offered solutions, atleast the theory of it. But does anyone have a 'real' solution codewise? Or am I supposed to slow down my sprite's movement until the collision works properly. Buying box2d as a starter developer, merely for the ccd, seems to be a bit overextending.
15. Sprite movement too quick for timer event to capture

Hi, As the title already reveals: I'm trying to capture when two objects are colliding for 90% of their coordinates. Yet the Phaser update method was too slow, so I called the collision function in a timer event that ticks every millisecond. Yet it still isn't registering the collision, which hardly seems possible because the sprite isn't moving that fast, anyone has a clue? The timer event: this.game.time.events.loop(1, function(){this.collides, (this.shootingCircle, this.targetCircle)}, this); The collision function: collides: function(a, b) { if(a.y < (b.y * 1.1) && a.y > (b.y * 0.9) && a.x < (b.x * 1.1) && a.x > (b.x * 0.9)) { if (this.alertSent == false) { alert('You Won'); this.alertSent = true; } var self = this; setTimeout(function() { self.moving = false; self.aiming = false; self.alertSent = false; self.game.state.start('Game'); }, 350); } },