Rotating in a Room With Four "Walls"

help
helpwithcode

#1

I'm trying to build a game where the player can turn around to see the 4 different walls in the room. For testing purposes, I just have text ("Wall1", "Wall2", etc) which represents each of the four walls.

I'm using a "controller" element (an empty block) to set the conditions. In this block I have a value ("wall") that I set 1 digit up or down whenever the left or right button is tapped, respectively. So for example:

When "right" is tapped 
    Check if/else  - "Wall" = 1
        Set Value "Wall" to 2
    Else
        Check Once if "Wall" = 2
            Set Value "Wall" to 3

and so on ("When Game Starts" the value of "Wall" is set to 1). And then the same for the "left" button except it goes down by 1 digit:

And then I have each of the Walls set to Invisible when the player isn't "facing" that wall, like this:

For some reason, it works perfectly for the "left" button, when rotating through 1, 4, 3, 2, 1 etc but when tapping "right" there is some kind of glitch that causes it to skip 3 and 4. I've checked it thoroughly and I can't figure out why it's doing this.

Does anyone have any ideas? I've tried to "Wait" a bunch of different ways, and I tried a few different configurations of the Check If/Else blocks but this is the closest I've gotten.


#2

Your Albert Einstein aren't you


#3

It might help if instead of having your long chain of check once if else blocks, you put one that says, "if Wall < 3 (or 4? experiment) increase value Wall by 1. Else, set value Wall to 1" for the right button, "if Wall < 1 (or 0? again, you'll need to experiment) increase value Wall by -1. Else, set value Wall to 4" for the left.

I don't know if this will work, but it is at least cleaner and less laggy with only two check once if else blocks.
I haven't really experimented with this, so my numbers may not be correct, but you could mess around with those.
I recommend having a random text object that repeats forever set text to Wall, so you can tell if it is working or not, or where the problem is. Afterwards, you can just delete the object.


#4

lol, no, I'm not good at science, I'm just good at words, haha :smile:


#5

Jk lol

And wow I have no clue how that wall stuff works


#6

I think Puffy's got it! Just get rid of all of the check once if blocks and replace it with Puffy's, and it should work. :smile:


#7

@Metaforest, how was @Caramel_Puffin's explanation? Was it resolved?

Oh, I just realized that the last post was 5 hours ago. Oops. :P


#8

Yes, that worked! I changed it to "If Wall < 4 increase by 1" like you suggested and now its perfect! Thank you so much!


#9

You seem satisfied now.
Good luck with your game.


#10

WHY DO SO MANY PEOPLE SOUND SO GROWN UP XD


#11

The forum is more than just kids... there are more mature adults too, you know. :P


#12

I know. But I also know (scrap that) THINK (wait no) thought (at least) that he (Stradyvarious) is a kid :P


#13

Funny you refer to me as "HE"


#14

Wut

Ur a girl

Oh ok sure that's great wow awesome so amazing sorry I'm babbling