Really cool Sword example

So… while trying to figure out some stuff for my ongoing game, I made this really cool sword system where basically how much you move your mouse is how much swings you get, like if you dont move your cursor or move it very little, the slice isnt gonna happen, but if you swing in a small space rapidly, lots o slashes come out.
Personally, I find this one of the coolest sword/stick swings ever, cause you dont click but rely on your mouse to swing. Not sure if people are gonna start using this, or if there will just be people using it everywhere, but here it is: Flowlab Game Creator - Ewarks

7 Likes

What do you guys think? I want the pros to look at this
@CodeAlpaca @JR01 @Samuel_PixelPizza @Pixel_Name1 @BradenS @puginarug

2 Likes

AMOGUS

4 Likes

It’s cool👍

I would organize the code differently than you and add some notes if it’s an example, but it works good (I’m on a mobile rn)

I would also change some small things, I’ll send over a screenshot of it.

1 Like

This I would organize better and possibly bundle it.

There are also some other coding things I would condense down a bit with expressions/different methods, but it’s hard to do it on mobile so I’ll do it later when I’m on a computer

3 Likes

:rofl: Its modeled off of Ewoks, so thats like a stormtrooper, but I named it the stormtrotter and the Ewoks Ewarks because it sounds like Quarks and for some reason that’s funny to me

2 Likes


Also, a rose I drew for a competition

7 Likes

Pro??? Me??? Never thought I would be included with Jr01, CodeAlpaca and PixelPizza

4 Likes

You. Are. A. Pro. Ur games and art styles are :heart_eyes:

But whaddya think about the mechanic, too me bout a hour and a 15 mins to do everything, so it’s simple

1 Like

It’s pretty cool! I’ve tried something like that before but just gave up lol

1 Like

Also made it so the attached object doesn’t become weird with the rotations


I would set it up like this (inside the stick object)

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Condensed Version","behaviorType":"logic.NodeGroup","x":-90,"y":0,"group":"","id":"07676383f37b094a","isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Spawn","behaviorType":"logic.components.Spawn2","x":810,"y":32,"group":"07676383f37b094a","id":"0767ed96daac9b4d","entityClassId":16001624,"spawnX":0,"spawnY":0},{"inputCount":0,"outputCount":2,"name":"MouseMove","behaviorType":"logic.triggers.MouseMove","x":-270,"y":0,"group":"07676383f37b094a","id":"07683cdf22124d42","gameCoords":true},{"delay":4,"count":0,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":-270,"y":160,"group":"07676383f37b094a","id":"076859ab9248804e"},{"expression":"Math.abs(A-C) || Math.abs(B-D) > 15? 1 : 0","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":4,"version":2,"tag":"","inputCount":5,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":90,"y":0,"group":"07676383f37b094a","id":"0768fbfa6dd5184b","notes":"Detects if hand moved 15 pixels in 0.4 seconds.","n_o":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-90,"y":192,"group":"07676383f37b094a","id":"0769b47d9b21c740","startVal":0,"tag":"Hand Y (Old)","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-90,"y":96,"group":"07676383f37b094a","id":"0769b5070b6eb24c","startVal":0,"tag":"Hand X (Old)","roundMode":1},{"gateVal":1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":450,"y":32,"group":"07676383f37b094a","id":"076c49a95e8ca445"},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":630,"y":96,"group":"07676383f37b094a","id":"076c97b72135274d","targetId":0,"prop":"y","version":2},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":630,"y":0,"group":"07676383f37b094a","id":"076c983a9b6b534c","targetId":0,"prop":"x","version":2},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":630,"y":192,"group":"07676383f37b094a","id":"076d6c0b658eb944","targetId":0,"prop":"rotation","version":2},{"inputCount":2,"outputCount":1,"name":"PointAt","behaviorType":"logic.components.PointAt","x":-270,"y":-96,"group":"07676383f37b094a","id":"076d8b043fd85443","skipRot":false},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":270,"y":32,"group":"07676383f37b094a","id":"076f1557250b0440","_startVal":1,"dataType":2},{"delay":4,"count":0,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":90,"y":192,"group":"07676383f37b094a","id":"076f4dad199d6d4d","notes":"Set to 4. This is to limit the amount that can be spawned constantly.","n_o":1},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-90,"y":-96,"group":"07676383f37b094a","id":"0787c626f8c9b041"}],"links":[{"input_id":"076d8b043fd85443i0","output_id":"07683cdf22124d42o0"},{"input_id":"0768fbfa6dd5184bi0","output_id":"07683cdf22124d42o0"},{"input_id":"0769b5070b6eb24ci0","output_id":"07683cdf22124d42o0"},{"input_id":"076d8b043fd85443i1","output_id":"07683cdf22124d42o1"},{"input_id":"0768fbfa6dd5184bi1","output_id":"07683cdf22124d42o1"},{"input_id":"0769b47d9b21c740i0","output_id":"07683cdf22124d42o1"},{"input_id":"0769b5070b6eb24ci1","output_id":"076859ab9248804eo0"},{"input_id":"0769b47d9b21c740i1","output_id":"076859ab9248804eo0"},{"input_id":"076f1557250b0440i2","output_id":"0768fbfa6dd5184bo0"},{"input_id":"0768fbfa6dd5184bi3","output_id":"0769b47d9b21c740o0"},{"input_id":"0768fbfa6dd5184bi2","output_id":"0769b5070b6eb24co0"},{"input_id":"076c983a9b6b534ci0","output_id":"076c49a95e8ca445o0"},{"input_id":"076f1557250b0440i0","output_id":"076c49a95e8ca445o0"},{"input_id":"076c97b72135274di0","output_id":"076c49a95e8ca445o0"},{"input_id":"076d6c0b658eb944i0","output_id":"076c49a95e8ca445o0"},{"input_id":"0767ed96daac9b4di1","output_id":"076c97b72135274do0"},{"input_id":"0767ed96daac9b4di0","output_id":"076c983a9b6b534co0"},{"input_id":"0767ed96daac9b4di2","output_id":"076d6c0b658eb944o0"},{"input_id":"076c49a95e8ca445i1","output_id":"076f1557250b0440o0"},{"input_id":"076f1557250b0440i1","output_id":"076f4dad199d6d4do0"},{"input_id":"0768fbfa6dd5184bi4","output_id":"0787c626f8c9b041o0"}]}}}

Obviously would require a bit of tweaking to get it to feel how you want.

The Expression has this “Math.abs(A-C) || Math.abs(B-D) > 15? 1 : 0” (JR are you proud of me :smiling_face_with_tear:)

  • “Math.abs(A-C)” This finds the absolute X of the current mouse position and the X position from 0.4 seconds ago.

  • " || " This symbol means “or” in haxe code. Something I recently learned from Jr on the discord.

  • “Math.abs(B-D)” This finds the absolute Y of the current mouse position and the Y position from 0.4 seconds ago.

  • " > 15?" this is asking if the previous equations are greater than 15. (this value is in pixels)
    Basically "(X1-X2) or (Y1-Y2), is greater than 15?

  • “1 : 0” This is how to get the yes or no answer from the question (Yes : No).
    If “Yes”, it outputs 1. If “No”, it outputs 0.

You could also switch thr equation to look if the rotation is different by something like 10 degrees or whatever amount you want.



And like this in the Slash object.

This method is more complicated and not a lot of people actually know how to use haxe (myself included, I only know a small portion). Personally I think it’s a better method due to being more condensed (and easier to understand, for me at least), but others might say it’s too complicated for an example :man_shrugging:

2 Likes

Eh, i’m definitely not a pro, i also don’t think the example is especially great, sorry

1 Like

Yeah I get this, but for new people, it might be weird to figure it out, but I know this is better, :+1:

I might try to figure out how to make the swing sprite larger if the swing is larger, so it gives a incentive to use larger swings to target big And weak groups

This a Ewark with a saber, I think 0,4 seconds if the minimum if you want it to track the distance, any less and its always 0, @CodeAlpaca , can ur code make it less?

1 Like

You can also swap between the stick and saber with E

My timer was set to 4, for 0.4 seconds. You’re is set to 0.04 seconds.

So mine can go lower, I just chose 4 because I liked the result. You can mess around with the values to see what you like best.

1 Like

I am actually using this mechanic to make a game now, I have a new topic for it, EWARKS

1 Like