To train myself in Construct, I am trying to put together a very simple Space War type game...
I have made a Black Hole object (a box!) at the center of my test playfield using the ADD FORCE TOWARDS action. Perhaps my math is wrong, but the following:
->Sprite: Add force 300-distance(Sprite.X,Sprite.Y, Box.X, Box.Y) towards (Box.X, Box.Y)[/code:19jjef0x]
Will actually repulse the player instead of attract them when the player is on the outskirts of the playfield... I guess because the "300-distance" equation turns up a negative number? Is there a simple way to calculate for that?
Also this method produces very linear results... The force pulling the ship in should become exponentially greater as you get closer to the center of the black hole. That way you can fly around on the outskirts of the playfield with no pull towards the center at all. But if you get too close, you'll get caught in the black hole and sucked in.
Is this the right way to do this kind of thing in Construct?
As an alternate, I made a new version where the force is not applied unless the player sprite overlaps another large CIRCLE sprite I've added to the center of the playfield. Adding a few of these give the desired slight pull, then much greater pull that I'm looking for -- but I can't help thinking this is the wrong way to go about this, and that there is a simple (i.e. MATH) way of handling all this.
Any suggestions..? Current "Double Circle Overlap" version can be found here:
[url]http://www.mediafire.com/file/xp3xr875059678k/Black%20Hole.cap[/url]
P.S. My apologies to R0J0hound for stealing his ship sprite... I was just using it for testing. Gonna change it soon!!