Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Very cool entry. The concept of gathering and using your foes weapons to be come more powerful is interesting. What did you use for the movement of the weapons? Some sort of flocking algorithm? It looks very smooth. Congrats

Thanks for playing!

The weapons use sine waves to calculate where they should be. Here's the entire function used to figure out where each weapon should be. This runs in physics process.

time += delta * orbit_rate
var i = 0
for w in weapons:
    var offset = float(i) / 2
    var new_pos = blade_focus.global_position + Vector2(sin(time + offset), sin(time + offset - 1)) * orbit_distance
    w.move_and_look(new_pos)
    i += 1

Sin returns a value between -1 and 1. Feeding time into it oscillates the returned value over, you know, time. 
Using that to construct a Vector2 with an offset on the time gives you a point that revolves around the focus point. 
That point is then multiplied by orbit_distance.
The blade_focus is a Node2D that follows the character except when you're holding the mouse button down.
The offset variable is there so the weapons aren't all trying to be in the same location at the same time. If you have 12 weapons, each is half a second behind the next. 
Then you can modify orbit_rate to speed up or slow down the rotation. Can also use a negative number to reverse the rotation direction. 

Move and look is a simple function that does exactly what's written. The weapons are character bodies and handle their own actual movement. 

Hope that explanation makes sense!

Haha. The funny thing is that I'm using more or less the same in my game to have captured orbs going around the player. I recognise that movement pattern when the player in your game is still, but when the character it moving it seemed something different because they are no longer just orbiting around the player.