Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Rock, paper, scissor.  (Read 5762 times)

0 Members and 1 Guest are viewing this topic.

Pridexs

  • Newbie
  • *
  • Posts: 5
  • Wat.
    • View Profile
    • Email
Rock, paper, scissor.
« on: July 12, 2013, 04:14:43 am »
Hello all,

Bear in mind that I do not have a lot of knowledge in C++, I started to implement Classes and Pointers and whatnot in this Jokenpo game for the first time.

I want to know how can I improve what I am doing. I know that I could've shorten a lot my code and possibly make a few changes.

Obviously, I don't want you to write any code for me, but I want to know if I am in the right path or I should go back, and revise everything I thought I know ?

Anyways, without further ado, here it is:

Game Download: https://dl.dropboxusercontent.com/u/14138136/Games/PROJECT%20NOVA/Project%20Nova.rar
Game Source Code: https://dl.dropboxusercontent.com/u/14138136/Games/PROJECT%20NOVA/NOVA%20Source%20code.rar

Controls:
Menu: Mouse
Game: Arrow Keys and Enter Key

Why I didn't implement keyboard in the Menu ? No Idea.
Is there a way to make some kind of delay ? You can see that the hand flickers a lot, I did an if with several statements(?) with a sf::Clock, but that was very buggy and weird to use, so I decided to leave as it is.

Thanks,
« Last Edit: December 27, 2013, 12:24:39 am by Pridexs »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Jo-Ken-Po Game.
« Reply #1 on: July 12, 2013, 10:20:20 am »
Ah, couldn't imagine anything under "Jo-Ken-Po". :) Just call it "rock, paper, scissor". Most will know it under that name. ;)

Besides that: This forum is perfectly fine to show off even tiny projects, especially if you're looking for feedback, it's something to play around with, and you aren't just looking for someone to fix that one specific bug.

Might take a look later, but you flickering note sounds like you have to rethink some animation or drawing concept somewhere along the lines.

Pridexs

  • Newbie
  • *
  • Posts: 5
  • Wat.
    • View Profile
    • Email
Re: Rock, paper, scissor.
« Reply #2 on: July 12, 2013, 03:35:46 pm »
Awesome! Thank you!

I changed the name of the thread, it is a more universal thing indeed. :P

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Rock, paper, scissor.
« Reply #3 on: July 13, 2013, 02:55:29 pm »
I poked around through your source code, and I have some advice:

1. Don't define a global header file like you did. Have bool isRunning contained within a class, main.cpp, or pass it around as a parameter. It's bad practice to keep global variables.

2. Instead of having a textures() or init() method, initialize from the constructors of each class. You did this on game.h and menu.h.

3. In general, your draw() methods have a lot of things that would be better suited under an update() function or similar. Things such as looping through conditions and setting strings, etc.

4. You drew things in methods other than draw() like tie() and lose(). You should keep all the drawing in one place.

5. Great job on your first game. Keep practicing and learning C++!
Current Projects:
Technoport

Pridexs

  • Newbie
  • *
  • Posts: 5
  • Wat.
    • View Profile
    • Email
Re: Rock, paper, scissor.
« Reply #4 on: July 13, 2013, 04:20:31 pm »
I'm not sure why I didn't just initialize everything on the constructor, but I will do that next time!

Thanks for the Feedback, I really appreciate it.

 

anything