Jump to content

  • Log In with Google      Sign In   
  • Create Account


stitchs

Member Since 22 Feb 2011
Offline Last Active Sep 17 2014 03:18 PM

Topics I've Started

Returning to Programming

14 June 2014 - 06:19 AM

Hi all,

 

So after a year out from programming, and the forums, I have decided to return to thing that I love!

 

I have been out of the loop for so long that I am effectively starting again. I want to start with a language that is easier to understand, and plug away at, than C++. It didn't work for me before, but I hope to go back to it at a later date.

 

I want to program, and I want to see results fast(er than C++), so I have decided to go with C#. Is this a good choice? What are good resources/books to start from the ground up. Is it worth going into XNA.

 

I know this sounds like a lot to ask, and I am not unfamiliar by any means with forum guidelines, but if there is any advice, I will gladly take it.

 

Thanks in advance for reading/replying,

 

Stitchs.


'Completed' Pong Project; looking for Critique.

29 December 2012 - 09:02 PM

Hey guys,

I have been working on this for about a month and half now, with two weeks spent on the first iteration and the last 3-4 on changes suggested by this wonderful community.

 

I have worked my way through the the list and am now (in loose quotations) finished. I am pleased with what I have learned on the way, and how I will take some of it forward. I also realise that my code was nowhere near what it should have been and have revised much of it.

 

There are still some issues:

  • Hard-coded/cumbersome state machine in Game.h (to be revised in next project)
  • Ball sprite appearing white (this is one I could use some advice on)
  • Game over text being highlighted incorrectly
  • Lack of sound/save functionality.
  • Players should probably by local to Game.h and opposed to Arena.h

 

 

Could I get you guys to try it out, and have a gander at the code as some new feedback would be excellent to take into the next project. Please find this below.

 

I write this late and will probably think of extra things, and add them tomorrow.

 

Regards,

 

Stitchs.


Comparing a negative value against std::vector.size()

15 December 2012 - 04:23 PM

Hello community,

I am having a minor issue in my code, I have replaced an Integer variable with the std::vector.size() in a comparison statement (please see below):

[source lang="cpp"]if(selectedOption_ > (optionsList_.size() - 1)) { selectedOption_ = (optionsList_.size() - 1); } else if(selectedOption_ < firstSelectableOption_) { // Highlighted option does not trigger as going less than 0. selectedOption_ = firstSelectableOption_; }[/source]

Before, I compared SelectedOption to an Integer (numOptions) and this worked as I expected, if it went greater than said number then it would be reset to numOptions, else if it when less than 0(firstSelectableOption), it would be set to zero.

Once I replaced it with size(), if the SelectedOption goes less than zero, it triggers the 'greater-than' clause and sets the SelectedOption equal to whatever the size()-1 is. I have looked through the debugger and the numbers are coming back as expected: SelectedOption becomes -1, and size in this instance being 2. So what is going on here. The quick-fix solution I am using is this:

[source lang="cpp"]if(selectedOption_ < firstSelectableOption_) { // Highlighted option does not trigger as going less than 0. selectedOption_ = firstSelectableOption_; } else if(selectedOption_ > (optionsList_.size() -1)) { selectedOption_ = (optionsList_.size() - 1); }[/source]

This ensures that the check for going less than zero occurs first, which solves the issue I am having, but does not answer the question it puts forward.

In short, is there something I am missing that would be firing the if-else in reverse order. Also, I have checked and am not setting size equal to something different elsewhere.

Thanks in advance for your time,

Regards,

Stitchs.

Pong Project near completion; looking for Critique.

02 December 2012 - 05:17 PM

Hello community,

I have completed a small Pong project, I am quite happy with it and am looking towards the community now that I am at a point to share it. At some points it got me down, as this was my first outing with SFML and there are some aspects that I definitely need to understand better (such as the ordering of event queues and key-presses), but I am happy that i persevered.

I wasn't sure where to put this, it is kind of an announcement, but I am also looking for a code critique and some feedback. Basically, I have gone back to basics and am trying to code a game as quickly as possible, with as few mistakes as possible, but they definitely exists. Currently I am aware that the Paddle and Ball classes share some methods, and this will lead me to developing an inheritance structure, this is one of the known issues and an example of what I am aware of in my code.

I am trying to find as many shortfalls and understand why some concepts shine, through the experience of not using them.

A few things I am aware of:
  • Hard-coded values,
  • Movement that jutters at times.
  • Over-diluted with methods that could be combined.
  • Unclear comments in some places.
  • A few methods that are not used or have no body.

I appreciate any feedback on my code and the application itself, and look forward to your comments. Below you will find two rar files attached, one with the exe and one with the Header/CPP files.

Regards,

Stitchs.

Help with event system in SFML 1.6

18 November 2012 - 01:06 PM

Hello,

I have a quick question regarding SFML 1.6 for C++. I have searched around for information but am limited to the tutorials on the SFML website.
I am currently in the process of making a separate Main Menu class and am wondering 2 things:
  • Do I need to create a separate events queue for the menu, and destroy it when I move into the Main game (making a new one for each 'state'?). Or, do I pass in the events queue from the Main window by reference, and feed events back into it, thereby using the same events queue for the Menu and Game (and as well as other game 'states').
  • Where do I handle events relating to the Menu, do I handle the, within the loop that checks and processes events or, do I handle them like in the tutorial linked here: http://www.sfml-dev.org/tutorials/1.6/sources/window-time.cpp , after where elapsed time is set.

If you need anymore information, or a link to some of my code to help narrow down what I am getting at, I am more than happy to provide it.

Regards,

Stitchs.

PARTNERS