Help with creating rooms for a Rougelike

id: 750997

category: Help with Scripts

posts: 5

I have been trying to figure out how to make a set of boxes always create next to each box, but sometimes when it goes offscreen it can't check for if a box is there or not. So there is a chance that it will go diagonal or completely away from the rest of the group. Can someone help me find the solution?

Project: https://scratch.mit.edu/projects/991962671/
Have you tried using a grid system with a list? Or assigning some kind of coordinates to the rooms? I think it could simplify the issue a lot.
RokCoder RokCoder loading
Without wanting to change your code too much, you could adjust it so it scales the size down while creating the map.

Add a size change to the beginning of Setup Rooms

define Setup Rooms
set size to (25) %
...

And modify the positioning during Setup Rooms

...
change x by (([sin v] of (direction)) * ((62) * (0.25)))
change y by (([cos v] of (direction)) * ((62) * (0.25)))
...

And reset the size at the beginning of MOVE CAMERA

when I receive [MOVE CAMERA v]
set size to (100) %
...

If you want to see the map creation at the smaller size, detach the script from the MOVE CAMERA receiver before hitting the green flag.

RokCoder wrote:

Without wanting to change your code too much, you could adjust it so it scales the size down while creating the map.

Add a size change to the beginning of Setup Rooms

define Setup Rooms
set size to (25) %
...

And modify the positioning during Setup Rooms

...
change x by (([sin v] of (direction)) * ((62) * (0.25)))
change y by (([cos v] of (direction)) * ((62) * (0.25)))
...

And reset the size at the beginning of MOVE CAMERA

when I receive [MOVE CAMERA v]
set size to (100) %
...

If you want to see the map creation at the smaller size, detach the script from the MOVE CAMERA receiver before hitting the green flag.

I varied the size to 8% for larger maps. THANKS SO MUCH FOR THE HELP!