Reliable 'Drag And Fling' Function ?

GameArtForge

  • Posts: 21
Hi, has anybody created a reliable 'fling' function they would be willing to share ?  I've tried downloading the behaviour from StencylForge, but that doesn't work correctly or even head in the correct direction most of the time, I simply want to drag and fling an object ( ideally with a visual representation of the direction I want to go in, i.e. an arrow ).  I want to make a variant on a pool game, but I can't get this basic functionality up and running to start, so would appreciate any help from those that may have already covered this behaviour ?

Thanks

MrMusicalLion

  • Posts: 95
When you say fling,
Do you mean that you want the user to drag back something,
and that it will automatically catapult when they release -

Or do you mean that the user has to drag it back and then manually fling it forward themselves?

You should have a look at the catapult demo game [angry birds clone], included with stencyl, perhaps.
If you imagine that the catapult itself were the pool cue and that the stone were the ball.. you might be able to adapt or learn from whatever method is being used in that example.

I'm not sure if that'll help but that's where I would start. Good luck.

GameArtForge

  • Posts: 21
Hi,

The first one, the user drags it back, then let's it go and it catapults out in the correlating direction.

And thanks for that tip, I didn't even think about that ! :)

MrMusicalLion

  • Posts: 95
:) Thanks. And yeah, I'd start by taking that demo and editing the physics settings for the scene, so that there is no gravity. That way, you already have something similar to a ball being hit in the direction of your choice. After that just change the graphics and voila!

Notice how even the way that the wooden planks disperse, is kinda similar to how the balls would need to react? :P