A more complicated request

this is kinda hard to explain but i’m looking to implement a feature where the player can hold their mouse to sling the player a direction but i also want it to attack an enemy. I would also like for a arrow to point the direction they will be slung.

well, time to get working on an example, although, have you tried making it yourself?

and if you have then what problems did you have?

I have tried making it myself but I am very inexperienced considering I just started doing this a few months ago

I am still currently trying to make it.

A little more clear explanation, I want the player to hold the mouse down and when they release it launches the player the direction they aimed

ooooh, i actually made a game prototype thing with that exact feature, give me a minute to find it

1 Like

Flowlab Game Creator - Copy of Jellyfish here ya go! it’s not perfect since i did it when i was very new to flowlab but i think you’l be able to do something with it

i think you should change the impulse to a velocity

So angry birds, or like the demo game on the front page.
Does the example Puginarug gave you work or do you want it like angry birds so you hold back in the opposite direction and the farther you pull back the farther it will shoot.

btw @puginarug in your example you don’t need an Always going into the Animation because you have the Animation set to ‘Loop’.

Also, the Full-Screen behavior doesn’t need to have “Esc” turn it off, pressing "Esc’ naturally does this so there is no need to add another behavior for this.

Yes, Exactly. The example Puginarug gave me was great, but its not exactly what i’m looking for.

If it’s like Angry Birds, I would recommend using an impulse to launch in a general direction and change around the Gravity and Density of the objects.

1 Like

yea, as i said, i made it when i was very new to flowlab so there’s lots of mistakes

Sorry to ask so much later but how do I make it so when the player clicks in a direction it launches then in that direction of where they clicked?

Use point at and impulse (The X and Y values for the Point at are the cords of the mouse)

1 Like

I’m sorry i’m quite new to all of these behaviors, I’ve never made anything like this so if you don’t mind explaining in a bit of a more simple way that would be great.

There is a behavior called Point At (you can select it so it does not rotate towards the direction that is outputted), the inputs for Point At will be Mouse X and Y (You can get these values with the Mouse Move behavior). That should only be 2 behaviors.

Then, when you want to move have a number go into the “Forward” input on the Impulse behavior. (It will move you towards the mouse because the Point At behavior set your Forward direction to the angle between your character and the mouse)

So it should be

Mouse Move (X and Y) → Point At (X and Y)

Mouse Click (Down) → Number (What ever you want) → Impulse (Foward input)

In case you didn’t know about this here is the Behavior Handbook.

I went through it a few times when I first started until I knew what every behavior did to a decent degree and that helped me learn so much faster compared to trying to figure out what everything did on my own or even asking for help. Just knowing what does what will speed up game development because you won’t need to think as long and it’s great long term.

Thank you, I appreciate it