This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mrSLIMEguy's profile picture

[1.48] YellowSquare Game

Started by mrSLIMEguy, 14 January 2013 - 05:44 PM
mrSLIMEguy #1
Posted 14 January 2013 - 06:44 PM
YellowSquare is a small game I made in 7-14 minutes. You must click the yellow square to get points. If you miss, you get game over. :(/>

Hearing that, you may think that this game is super duper easy. But the thing is that when you click a square, it doesn't go away. Another square gets generated somewhere else… But the square you clicked stays. Also, a square can spawn on another square, therefore making it hard to figure out where to click.

Controls:
  • Q to exit
  • Left click to click the squares
Note: This game requires an advanced computer. If you use a normal computer, the program won't work.

Screenshots
Spoiler[attachment=918:2013-01-14_16.13.27.png]
[attachment=916:2013-01-14_16.15.28.png]
[attachment=917:2013-01-14_16.14.21.png]

To download, type pastebin get NmRjTJLn yellowsquare

Enjoy my little game!
crazyguymgd #2
Posted 14 January 2013 - 06:50 PM
Nice job! Suggestions:
Add mouse click to the any key to start, since the mouse is what you use to play the game.
Reset the background color to black before you clear the screen. I don't like it leaving my screen yellow :)/>

Also, when I got up to 39 points, it must have put a new square over an old one, so there was really no way of knowing where to click. Now I don't even want to try to beat my high score because odds are, it'll just screw me again :P/>
mrSLIMEguy #3
Posted 14 January 2013 - 07:35 PM
Nice job! Suggestions:
Add mouse click to the any key to start, since the mouse is what you use to play the game.
Reset the background color to black before you clear the screen. I don't like it leaving my screen yellow :)/>

Also, when I got up to 39 points, it must have put a new square over an old one, so there was really no way of knowing where to click. Now I don't even want to try to beat my high score because odds are, it'll just screw me again :P/>

Well, this was just a little experement… AND the first "program" i posted. All my other topics can be found in the Ask a Pro section. E]:] <– random bunny

* goes to play on a CTF or a MCTF2 server*
RunasSudo-AWOLindefinitely #4
Posted 14 January 2013 - 08:47 PM
Did you implement that feature because you accidentally forgot a term.clear? :P/>
remiX #5
Posted 15 January 2013 - 01:43 AM
Also, when I got up to 39 points, it must have put a new square over an old one, so there was really no way of knowing where to click. Now I don't even want to try to beat my high score because odds are, it'll just screw me again :P/>

Yeah that happened to me too, I was like: "Nooo what to click?!"

I'd suggest that each time it adds a square, add it to a table and before getting random co-ordinates, check if they have already been used or something
mrSLIMEguy #6
Posted 16 January 2013 - 09:11 PM
Also, when I got up to 39 points, it must have put a new square over an old one, so there was really no way of knowing where to click. Now I don't even want to try to beat my high score because odds are, it'll just screw me again :P/>

Yeah that happened to me too, I was like: "Nooo what to click?!"

I'd suggest that each time it adds a square, add it to a table and before getting random co-ordinates, check if they have already been used or something
Well i tried, but i couldnt get it to work…. :P/>
RunasSudo-AWOLindefinitely #7
Posted 16 January 2013 - 09:24 PM
Well i tried, but i couldnt get it to work…. :P/>/>/>

table.insert(tableOfOldSquares, {newSquareX, newSquareY})

-- Later (in a generate-square-coordinate fuction)

while true do
  -- Generate newSquareX, newSquareY
  for i = 1, #tableOfOldSquares do
    local oldPos = tableOfOldSquares[i]
    if oldPos[1] ~= newSquareX or oldPos[2] ~= newSquareY
      return newSquareX, newSquareY
    end
  end
end
It just keeps generating squares until one of them is different. You might run into problems when the board is full though.
TheOutcast5 #8
Posted 16 January 2013 - 09:35 PM
It just keeps generating squares until one of them is different. You might run into problems when the board is full though.
Could always clear the screen and make waves or something
crazyguymgd #9
Posted 16 January 2013 - 10:40 PM
Well i tried, but i couldnt get it to work…. :P/>/>/>

table.insert(tableOfOldSquares, {newSquareX, newSquareY})

-- Later (in a generate-square-coordinate fuction)

while true do
  -- Generate newSquareX, newSquareY
  for i = 1, #tableOfOldSquares do
	local oldPos = tableOfOldSquares[i]
	if oldPos[1] ~= newSquareX or oldPos[2] ~= newSquareY
	  return newSquareX, newSquareY
	end
  end
end
It just keeps generating squares until one of them is different. You might run into problems when the board is full though.

Exactly what I wanted. New pastebin to try that part out?
Skullblade #10
Posted 17 January 2013 - 03:37 AM
You could have the square turn red(or any color) when it hits another yellow square then all the squares after that are red etc etc.
remiX #11
Posted 17 January 2013 - 09:00 AM
You could have the square turn red(or any color) when it hits another yellow square then all the squares after that are red etc etc.

I think that will defeat the purpose of that game. They're all yellow so you'll struggle to see which one is the new one that just popped up and it makes it hard when a lot of them on the screen…
Skullblade #12
Posted 17 January 2013 - 09:21 AM
yeah i guess your right but its more then hard when you cant tell what is new…
RunasSudo-AWOLindefinitely #13
Posted 17 January 2013 - 01:21 PM
You could make the square change colour if (and only if) it generates on top of an existing square. That would retain the "hardness" of the game while still keeping it playable.
Skullblade #14
Posted 17 January 2013 - 01:28 PM
yeah thats what i was thinking
Ki7654 #15
Posted 11 November 2013 - 04:48 AM
I reckon that the "Term.Clear" is not needed. This game fools you!

EDIT: I'm pretty sure that mrSLIMEguy noticed, but there is a glitch at the very end where the screen turns yellow. I don't know if that was on purpose, but it annoyed me so I put term.setBackgroundColor( colors.black )just after line 38 to fix the problem. This game is still awesome though!
Edited on 11 November 2013 - 04:02 AM
biggest yikes #16
Posted 15 December 2013 - 03:24 PM
I edited the yellowsquare code to fix many of the bugs found.
You can use this if you want, it's now yours :)/>
http://pastebin.com/8MzKVB3E

EDIT: Such as the overlapping one, I made those ones red
Edited on 15 December 2013 - 02:25 PM