←  Programs

ComputerCraft | Programmable Computers for Minecraft

»

[1.48] YellowSquare Game

mrSLIMEguy's Photo mrSLIMEguy 14 Jan 2013

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

To download, type pastebin get NmRjTJLn yellowsquare

Enjoy my little game!
Quote

crazyguymgd's Photo crazyguymgd 14 Jan 2013

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
Quote

mrSLIMEguy's Photo mrSLIMEguy 14 Jan 2013

View Postcrazyguymgd, on 14 January 2013 - 06:50 PM, said:

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*
Quote

RunasSudo-AWOLindefinitely's Photo RunasSudo-AWOLindefinitely 14 Jan 2013

Did you implement that feature because you accidentally forgot a term.clear? :P
Quote

remiX's Photo remiX 15 Jan 2013

View Postcrazyguymgd, on 14 January 2013 - 06:50 PM, said:

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
Quote

mrSLIMEguy's Photo mrSLIMEguy 16 Jan 2013

View PostremiX, on 15 January 2013 - 01:43 AM, said:

View Postcrazyguymgd, on 14 January 2013 - 06:50 PM, said:

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
Quote

RunasSudo-AWOLindefinitely's Photo RunasSudo-AWOLindefinitely 16 Jan 2013

View PostmrSLIMEguy, on 16 January 2013 - 09:11 PM, said:

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.
Quote

TheOutcast5's Photo TheOutcast5 16 Jan 2013

View PostRunasSudo, on 16 January 2013 - 09:24 PM, said:

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
Quote

crazyguymgd's Photo crazyguymgd 16 Jan 2013

View PostRunasSudo, on 16 January 2013 - 09:24 PM, said:

View PostmrSLIMEguy, on 16 January 2013 - 09:11 PM, said:

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?
Quote

Skullblade's Photo Skullblade 17 Jan 2013

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.
Quote

remiX's Photo remiX 17 Jan 2013

View PostSkullblade, on 17 January 2013 - 03:37 AM, said:

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...
Quote

Skullblade's Photo Skullblade 17 Jan 2013

yeah i guess your right but its more then hard when you cant tell what is new...
Quote

RunasSudo-AWOLindefinitely's Photo RunasSudo-AWOLindefinitely 17 Jan 2013

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.
Quote

Skullblade's Photo Skullblade 17 Jan 2013

yeah thats what i was thinking
Quote

Ki7654's Photo Ki7654 11 Nov 2013

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 by Ki7654, 11 November 2013 - 05:02 AM.
Quote

biggest yikes's Photo biggest yikes 15 Dec 2013

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 by minimite, 15 December 2013 - 03:25 PM.
Quote