Random Actor Placements.
Jigglebox
Member Posts: 63
I'm trying to code random placements for actors in a way that will always leave enough room for the player to get through. I want this to have an indefinite length where it won't stop unless you die. However, the scene will be on a loop, but I don't always want the game to use every open space except for one... I want there to sometimes be more than one open space, such as giving the player several options on where to go in order to make it through.
Also, there must be enough room between these placements for the player to maneuver. So a set space between each new "group" of actors.
Is the only way to accomplish this by creating multiple preset patterns and having the game randomize between those?
I want the actors to look something like this;
[]___[]___[][]___________[][]
___[]____________[]__[]____
______[]______[][]_________
_[]__[]____[]________[][][]__
=/ any help is appreciate, Thank you.
Also, there must be enough room between these placements for the player to maneuver. So a set space between each new "group" of actors.
Is the only way to accomplish this by creating multiple preset patterns and having the game randomize between those?
I want the actors to look something like this;
[]___[]___[][]___________[][]
___[]____________[]__[]____
______[]______[][]_________
_[]__[]____[]________[][][]__
=/ any help is appreciate, Thank you.
Best Answer
-
SmokeyAce73 EarthPosts: 370
Try adding a new actor your player can walk on
Add attributes
boolean: not walkable
boolean: walkable
Add actor
Walkable block
non walkable blockMake walkable true if a walkable block is spawned
Make not walkable false is nonwalkable block is spawnedRemember to change the attributes back to false when actor is spawned
Add rules to the spawner:
if attribute walkable is true
spawn actor notwalkableif attribute nonwalkable is true
spawn actor walkableHave a play around with that, its all i can think off
Quick question, do you have the actors spawning randomly or do you have set spawn Y locations?
Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!
Answers
at the moment i haven't put this into the game yet.
Currently I have my player actor moving at a constant rate to the right, however, I may change this up and have my Scene move to the left, as well as the randomly spawned actors in order to make the jumping / diving easier on the player actor...
But to answer your question that is what I am trying to decide... which one would be the easier solution? to have set Y spawns or have them spawn randomly? and through this would I be able to have set Y spawns, but then choose to spawn those at random and have each one spawn at the most the amount where there will always leave space to get through?
...
then just leave the random spawning to happen at set intervals based off of a timer that spawns at an interval over every 1.5 seconds or so?
would that work?
So each spawner would have it's only randomizer of a 50/50 chance, then ontop of that, it randomizes say out of all 5 spawners. (there may be more than 5) and the 5 randomize in a way that at the most will spawn 4 actors, never 5, but sometimes only 1 can spawn...
I realize this is confusing but if you are following me I'd love some help on how to accomplish it.