I was making an enemy- that uses colisions, ray-casts, and logic gates, and of course the velocity. I need to find all the possible combinaitions, for example, if the ray-cast casting to the right hits, and the ray casting to the top hits, than you go down, or right, using the random thingy, and the filter. Is there a simpler way to do this or do I have to make ‘and’ logic gates with two inputs up to 4?
You could use raycasts and collisions create movement for your enemy. For example, if you cast a ray in front of the enemy and if it hits, it could jump to avoid cliff. You could also do this with collisions. The rays can be casted in every direction to make sure it won’t bump into anything.
Yes, @MelloJello. That’s what I was doing. I just wanted to know any ways in which to simplify finding all possible combinations. In the game I am making, you are unaffected by gravity, and I try to make it look like you are seeing down from the sky. Your first comment gave me a tip, to use two and gates with two inputes instead of using one four inputed one. Adding that to the list! Any more tips?
Oh yeah, can you tell me how to change your profile picture?
Really. If I get one mistake, I will have to tear it appart and check it again.
Ooh! I think there’s 27…
Most Flowlabbians would probably look at that and say “ewwwww!!! Bruh, do you even bundle?”
But I look at that perfectly aligned stack of spaghettipity and am overcome with a warm soothing feeling of comfort and calmness. 'Tis a beauty to behold.
You gotta change that in Flowlab itself (not on the forum).
You will then probably also have to log out of both forum and game then log back in for it to appear as your forum pic.
There’s an actual math equation to find the amount of possibilities in something lol
nPr = n! / (n - r)!
N = number of items
P = permutations (how many combinations)
R = number of items being chosen at a time
You can do it in a scientific calculator.
Hey @Flying_Fahita - I’m having a bit of trouble understanding exactly what the intent of the logic is, but if I can understand it I may be able to offer some suggestions.
It sounds like you are trying to make an object auto-navigate through your level. Does that sound right?
Yes, @grazer. I am trying to make an enemy navagate randomly. For example, if the object bumps into something on the left, if raycasts on the top, right, and bottom (to see if when he goes there if he will bump into anything) and if they are all open, I make a random number, and use filters to determine which way he will go ( if equal to 1 than go up ect.)
lol. I know about the number of combinations multiplyed the number of combinations is equal to the amount of possiblilties? Like, if you roll 10 dice each with 10 numbers on them, there will be 100 combinations… I’m not sure what the R stands for. Thats all that my knowledge from my dad on a one hour car trip to the sea lol!
Thanks a lot! I didn’t log out of both forum and the game…
Ok, there are a few ways you could approach this, like maybe 4 raycasts and 4 switches? The way that seemed to me to use the least amount of logic is this:
- Make a NumberList that contains the 4 directions you care about: 0° (forward), 90° (down), 180° (left), and 270° (up).
- At the start of the game, and any time you collide with something, shuffle this list and make a copy.
- Pop off a number from the end, and send a ray in that direction. If the ray misses, then that direction is safe, so turn that way and start moving. If the ray hits, pop off the next number from the end of the list and keep trying until one of the directions is clear
I also added a timer so that the direction will change every few seconds also. This fixes cases where the raycast misses something that is actually blocking you, so you don’t get stuck forever.
I made an example here, with some notes: Flowlab Game Creator - Random Walk
Let me know if any of it is confusing.
It may not do exactly what you want, but you should be able to adapt the principle to your needs I think.
Now that I look at it, you can omit the “stop moving and think” blocks as well. I had a different plan in mind when I added those.
Edit: this is probably confusing, but the Number List Count block is only there so the list output can connect to the pop input.
That’s a unique way to use text lists, I’ve never thought to use them in listing values, that’d make my work much easier though. Thanks, even though I didn’t even ask the question in the first place!
That’s a unique way to use text lists…
I’m glad you found it helpful - but keep in mind that’s a Number list, which is a slightly different beast
The lists are under-used I think. This is probably my own fault, and I should make more examples, since they are super useful!
Yeah, lol I rarely use them. I only really use them for dialogue or more recent, a custom in-game calendar I made. But I’ll be using them this way a lot more often!
Also, yeah I don’t know the names of all of them so in my mind they’re all text-lists.
@grazer, I think I can figure it out by myself (I don’t understand it yet) if you give me the link to that game… That is so simple!! I didn’t really use lists either, and only for text. Thanks!
He posted it above the screenshot but here.
Lol… Thanks DinoDev.