Discuss Scratch

amazingendofoxy9
Scratcher
47 posts

better way to make the doors in my game?

https://scratch.mit.edu/projects/1104824398
im looking for a easier and more optimized way to make the doors work in my game
right now every door is a separate sprite and every character needs to individually have the coordinates they teleport to when coming out of a door listed individually (which is very tedious and easy to mess up)
is there a better way to do this?
(note many characters still have the outdated door script, to see the new one you can go to mephone4)
diamondgolem258
Scratcher
65 posts

better way to make the doors in my game?

Why when I go through a downwards door I exit through the right door? I should instead go through the top door because I'm moving down? If you make the doors consistent you could do something like this.
if <touching [Door v] ?> then

if <(y position) > [100]> then

move 1 room up
set y to [-150]
set x to [0]
else
if <(y position) < [100]> then

move 1 room down
set y to [150]
set x to [0]
else

if <(x position) < [100]> then

move 1 room left
set x to [150]
set y to [0]
else
if <(x position) > [100]> then

move 1 room right
set x to [-150]
set y to [0]
end
end
end
With this you only need 1 door sprite because where the sprites go isn't determined by the door sprite.
I'll try to make a remix when I have time to illustrate my idea.
diamondgolem258
Scratcher
65 posts

better way to make the doors in my game?

Also could you make the map more clear? I need to know which rooms lead where
amazingendofoxy9
Scratcher
47 posts

better way to make the doors in my game?

wdym
10goto10
Scratcher
1000+ posts

better way to make the doors in my game?

Data structures in Scratch are not that easy.

I started a case study using room and door names that each character sprite is intended to use and also each door sprite. It's a simple four-room, left and right door only. I just wanted to show the structure of the lists. Maybe you could look at what I've done and see if it makes sense for your project. https://scratch.mit.edu/projects/1379594869/
diamondgolem258
Scratcher
65 posts

better way to make the doors in my game?

I was talking about something like this https://scratch.mit.edu/projects/1379542282/
amazingendofoxy9
Scratcher
47 posts

better way to make the doors in my game?

ok i think i may have figured it out ( if the second part of the code that i have yet to do ends up working) but there is one big issue right now and im probably going to make a separate post for that

Powered by DjangoBB