Need Help with my coding game

I am working on this game, but it stumped me after I got to this point. Anyone know how to make this work???

Note that the controls of this game are as follows:

Type to code, with the following commands: (also enter to make the next line)

Move:

Move1, Move2, Move3, Move4, or Move5 (moves (amount given) in front)

Turn(right):

Turn1, Turn2, Turn3, Turn4 (turns(amount of turns determined by number))

2 Likes

I’d love to help! Very cool progress with the text engine, but can you elaborate on where you got stuck? I’m confused about what it is that you’re trying to implement this stage in coding.

Well, I can get it to read the first line, but anything after it doesn’t work.

Do you think you can just elaborate some more on what your game actually is? I’m still not clear on what it is you’re trying to do, so could you be more specific and give a good detailed breakdown of the vision for the game?

So basically, I want you to be able to type the code in multiple lines, with Move having the square move forward, and Turn having the square turn right. When you press Shift, then the code runs. Currently, the game processes the first line, then fails at processing the second line. I want it to go through all the lines of code you write.

Ok, well I took a closer look at your code, and there’s one big thing I noticed that you aren’t using for adding enters/newlines, and I’d recommend rewriting some code to utilize this: \n (make sure it’s a backslash). inserting this into a string automatically creates a new line for you, so your entire text block can be displayed on a single textSprite accessing one single string that you manage as the user types, adding \n when the user presses enter. (the character will not be displayed, it is interpreted as a enter/newline “character”). Not only does this simplify your typing code, it also simplifies the next step of interpreting the input once shift is pressed, as you should be able to separate out the string into an array at each \n occurrence.

1 Like