Discuss Scratch

VirusGaming2010
Scratcher
12 posts

Help with creating rooms for a Rougelike

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/

Last edited by VirusGaming2010 (March 29, 2024 17:00:00)

ProfessorUelf
Scratcher
100+ posts

Help with creating rooms for a Rougelike

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
Scratcher
1000+ posts

Help with creating rooms for a Rougelike

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.


Scratch dabbling for fun…

VirusGaming2010
Scratcher
12 posts

Help with creating rooms for a Rougelike

Thanks!
VirusGaming2010
Scratcher
12 posts

Help with creating rooms for a Rougelike

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!

Powered by DjangoBB