Planet Chili
http://forum.planetchili.net/

Simon Says Game
http://forum.planetchili.net/viewtopic.php?f=3&t=4052
Page 5 of 7

Author:  Zedtho [ July 13th, 2017, 9:23 am ]
Post subject:  Re: Simon Says Game

That was the last bug, now for refining!

I added this version to github by the way. Next up is a title screen, sound effects and tweaking some values

Author:  chili [ July 13th, 2017, 1:31 pm ]
Post subject:  Re: Simon Says Game

Good job man, looks like you're solving the problems one by one. I look forward to trying it out when you get it to a place that you're happy with.

Author:  albinopapa [ July 13th, 2017, 11:05 pm ]
Post subject:  Re: Simon Says Game

@Zedtho, looked through your code, seems to be working alright so no issues there. Couple of things I wanted to bring up, one being about the game play itself.

The colors have to go from 30 to 255 ( a range of 225 ) and the counter for the transition is only 60 frames. What I'm getting at is, I was wondering if that was intentional;, to have the next pattern chosen while the previous pattern was still transitioning?

The next thing I'd like to bring up and you are probably doing this during the refining portion you discussed, but the Square class can do so much more than just initialize values. For instance, you can create a draw function in the Square class that takes a reference to the gfx object. That way you don't have to have the 4 for loops in compose frame, you'd just call the draw function on each square; RedTopLeft.Draw( AxisX, AxisY, gfx ); for example. Since your left, top, right, bottom values in Square are offsets from AxisX and AxisY, you can pass them in as parameters to the draw function and do the calculations just like in the compose frame function. Personally, though, I'd make the left, top, right, bottom not be offsets and be absolute values. Then make a function called MouseIsOver or something along those lines that returns a bool by testing if the mouse pointer is inside one of those squares.

These are just ideas for simplifying your code and increase code reuse. You can even go further by making an array of Square objects and using the 1-4 indexing that you have, by just subtracting 1 since C/C++ arrays start at 0 instead of 1. This could eliminate the need for switch/case statements to determine which square your dealing with.

Author:  Zedtho [ July 14th, 2017, 6:41 am ]
Post subject:  Re: Simon Says Game

Yeah, the way I'm handling graphics is kind of screwed. I am aware that it takes 225 frames (3.75 seconds) for the colors ro fo back to normal. The odd thing I've noticed is that the colors only change rapidly at a certain point and then the change sort of fades away, which is odd to me, because these are numbers and I'd expect it to change linearly. Anyways, I've tried increasing the number that the colors get increased by but then the squares suddenly start going black and stuff. You can try that out yourself in that function with the ridiculously long name (ReturnAllColorsToNormalSlowly?) by making it an increment of 2 instead of 1.

Honestly, I have no clue how I should handle the graphics. Should I dim down the color or light it up when I press on it? Also, if you've played the game, you might've noticed there's a cooldown between each time I can select a color when it's my turn. I might turn that cooldown off.

I'll definitely add the drawing functions to the square class, seems like a good idea to clean up stuff.

Author:  albinopapa [ July 14th, 2017, 8:22 am ]
Post subject:  Re: Simon Says Game

Hehe, messing with the code, I left it in there and enforced the cool down period.

It is strange to me you decided to go dim when selected instead of lighting up, but it's up to you.

I've had some fun with this challenging project. I say challenging because I tried before you actually uploaded the code to make it more object oriented and encapsulating everything including the fading effects. The hard part was how to sync the fade with when the user or computer can choose the next square in the pattern. After seeing your implementation, I have come up with a solution. I haven't finished, but if you'd like to take a look let me know. It might help give you some insight on some things.

Everything I've used is still within the realm of the tutorials if you have watched all of the beginner series.

Author:  Zedtho [ July 14th, 2017, 10:03 am ]
Post subject:  Re: Simon Says Game

Sure, would be pretty cool to see! I might make it light up again, possibly make it look "whiter" and quickly dim back to it's normal color. Currently I'm working on putting the Square graphics in its class though. But I'll definitely make it light up next.

Edits
  • 1: Wish I had done that from the get go, I wasted so much time writing all that shit. It just took me 2 minutes to make it object oriented.

    If I want to display a title screen, can I include that function from a different header so that my game.cpp doesnt get super laggy? Thanks in advance.

  • 2:
    Removing void InitiateEndOfWorld(int RIP1, int RIP2); after further inspection I have concluded that it is not necessary.

  • 3: Now the squares are being lit up. Seems to work a lot better now. Will shorten the timeout now too

  • 4: If it's possible could you clarify what you mean with using boolean values for when Im selecting a square? Do you mean something like this:
    Code:
    bool IsSelected(Mouse mouse)
    { if(//Mouse is in all of the borders and left is pressed)
    {
    return true;
    }
    return false;
    }


  • 5: TimeOut is 60 (1 second) for ComputerTurn and 15 (0.25 seconds) for UserTurn. After userturn is finished, it's set to 60 so that ComputerTurn doesnt start just 15 after Userturn is finished
  • 6: Will upload the newest version to the github. Game is definitely not finished yet though.
  • 7: How do you guys clone my programs from github? I just see some random mumbo jumbo. Should I clone it from inside visual studio and then it converts it into human text?

Author:  Zedtho [ July 14th, 2017, 2:47 pm ]
Post subject:  Re: Simon Says Game

I've been looking for 4 sound effects, something like a chime or simply a button press. soundbible.com isn't available at the moment though, sadly.

Author:  albinopapa [ July 14th, 2017, 4:57 pm ]
Post subject:  Re: Simon Says Game

Zedtho wrote:
4: If it's possible could you clarify what you mean with using boolean values for when Im selecting a square? Do you mean something like this:
Code:
bool IsSelected(Mouse mouse)
{
   if(//Mouse is in all of the borders and left is pressed)
   {
      return true;
   }
   return false;
}


Yeah, something like this:
Code:
bool Square::IsClicked( Mouse &_Mouse )const
{
   const auto mx = _Mouse.GetPosX();
   const auto my = _Mouse.GetPosY();
   return
      ( mx > left  && mx <= right ) && ( my > top && my <= bottom ) &&
      _Mouse.LeftIsPressed();
}


You don't have to do the if( true ) return true else return false nonsense, just return the result of the boolean statement(s).

Attachments:
File comment: Here's how i clone
screenshot.png [145.82 KiB]
Not downloaded yet

Author:  Zedtho [ July 15th, 2017, 8:54 am ]
Post subject:  Re: Simon Says Game

Changed that! Thanks!

I was looking at the program from afar, and it has a shit-ton of if statements. Will that stay like that in the future? If I recall correctly Albinopapa was using "states". His program did look better organized than mine for sure.

Also, Im trying to use Chili's picture converter but he never told us how to use it as far as I know.
Nevermind! I looked at the code and was able to figure out that you need to rename the picture to poo (or alter the name in the source code itself) and put the picture in the file with the .exe. Then you click on .exe and you get your glorious .txt file. Also, I know I could've used Lux's design, but theirs has a limited size of pixels it can take, chili's does not. Before you do all this be sure to set your Alphakey RGB values. The default is 255,255,255.(background that will not be translated into PutPixel calls)

And yes, most of you probably know all this already :P.

Author:  chili [ July 15th, 2017, 11:59 am ]
Post subject:  Re: Simon Says Game

Good on you for going to the source (code) and figuring out out for yourself. Also, if you go to the #code-snippets channel on the Discord, there is an advanced version of it on there that will process all image files in one directory and output then to another one. Check it out!

Page 5 of 7 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/