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

Author Topic: Yellow Snake - w/Source (Updated 10/21)  (Read 13975 times)

0 Members and 1 Guest are viewing this topic.

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #15 on: October 21, 2011, 04:36:38 pm »
meissner61: Thank you for the compliment! But I did have some experience in Python before I started learning C++, so I was familiar with classes, functions, containers, variables, etc... C++ is definitely a different animal, but I am finding it to be a blast. And I have actually found some things in C++ come easier to me than they did or still have in Python. I think I am sold on this language for a while, and I'm sold on SFML for sure.

Pyrius: Excellent suggestions, and both of them should be very easy to implement! Thank you so much for playing it and commenting, and I will implement both of those ideas today!

[Edit: Pyrius, I implemented both of your suggestions, which were dead on. Others have agreed wholeheartedly that the game needed to start up in a Paused state. Also, solving the food issue (where you can see it spawning and jumping around if you have a really long snake) was as easy as adjusting the draw order so that the food draws before the body. This way it will always draw underneath the body if it spawns in the same piece of the grid. Again, thanks for those suggestions.]

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #16 on: October 21, 2011, 05:08:04 pm »
I have really appreciated all the input on my game! I updated the original post with the most current version and the most current source-code.

Any and all criticism and suggestions are welcome!! I have no pride concerning my programming abilities; all I am seeking to do is improve. So criticize away!! =)

Thanks to everyone who has helped me thus far!

Oh, and my snake now animates (or blinks rather), so maybe i should rename it Yellow Disco Snake.

Pyrius

  • Newbie
  • *
  • Posts: 39
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #17 on: October 21, 2011, 05:54:42 pm »
I played it again, and the blinking seems kind of strange. Maybe a way to toggle the blinking?

I also noticed that when you restart the game or change the game mode, the window closes and reopens. You could create an enum to hold the different game modes and have the main loop act differently depending on which game mode is currently stored in your game mode object (with switch/case). Instead of restarting the window with the new game mode, you'd just constantly check if the user presses F12 and change the game mode accordingly. This would probably make it easier to implement new game modes if you'd ever want to.

EDIT: The blinking is too frequent; the nodes are orange most of the time.

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #18 on: October 21, 2011, 06:21:35 pm »
Pyrius:

Thank you! The game no longer blinks by default. I made it so you can toggle it on by hitting F9, however, this isn't so much a feature that I'll make known any longer as it is a way for me to experiment with tiled_images and animations. I also slowed down the blinking a tad, just in case someone did want to turn it on.

Also, thanks for the advice on how the game restarts, etc... That will take a bit more to implement, so I will look into that today and see what I can come up with.

I appreciate your advice!

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #19 on: October 21, 2011, 09:56:40 pm »
Pyrius:

I implemented both of the changes you suggested. Restarting and Changing modes no longer restarts the entire program. It just calls a Reset() member function which resets all the settings based on the current mode (or switches modes and resets accordingly).

Thanks for the suggestion!

Pyrius

  • Newbie
  • *
  • Posts: 39
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #20 on: October 22, 2011, 12:55:35 am »
:) It's great now! It seems much more professional. I can't think of any other things that can be improved right now, but I haven't looked at the code yet.

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #21 on: October 22, 2011, 03:05:04 am »
Wow thanks. Those suggestions were definitely needed.

easy

  • Full Member
  • ***
  • Posts: 146
    • MSN Messenger - easy82.contact@gmail.com
    • View Profile
    • Email
Yellow Snake - w/Source (Updated 10/21)
« Reply #22 on: October 24, 2011, 01:34:56 pm »
I've played your game yesterday, nice work! Especially because you're using c++ for just about a month, and you've already came up with a game, and also because the source is not a sphagetti code what I've expected. Congratulations! :)

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #23 on: October 24, 2011, 10:11:20 pm »
Early,

Thank you for that comment! I am sure there is a lot about my code that could be done in more of "the C++ way," but I'm sure I'll continually improve it over time. However, to hear that it was at least coherent for someone else to read is very encouraging! Thanks you so much!

Naufr4g0

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #24 on: October 25, 2011, 11:17:34 am »
Quote from: "easy"
I've played your game yesterday, nice work! Especially because you're using c++ for just about a month, and you've already came up with a game, and also because the source is not a sphagetti code what I've expected. Congratulations! :)


What have you against the Italian coders? :'D
I don't think that outside Italy there are only good programmers.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Yellow Snake - w/Source (Updated 10/21)
« Reply #25 on: October 25, 2011, 02:16:32 pm »
I see I haven't commented on Yellow Snake itself yet, sorry ;)

Very nice game for your first project! It works very well. And it's funny you connect some personal anecdotes of your life with it :)

I remember one of my first games (or even the first?) was a snake clone, too... At the time I used SDL. My code was horrible, I used a single .cpp file, goto statements and a 500 line main() :D
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

easy

  • Full Member
  • ***
  • Posts: 146
    • MSN Messenger - easy82.contact@gmail.com
    • View Profile
    • Email
Yellow Snake - w/Source (Updated 10/21)
« Reply #26 on: October 25, 2011, 08:11:22 pm »
<offtopic>

Quote from: "Naufr4g0"
What have you against the Italian coders? :'D
I don't think that outside Italy there are only good programmers.


You know what, actually I love sphagetti! :D

Quote from: "Nexus"
I remember one of my first games (or even the first?) was a snake clone, too... At the time I used SDL. My code was horrible, I used a single .cpp file, goto statements and a 500 line main()


My heart skipped a beat when I've read 'goto'! :)

</offtopic>

bglaze

  • Newbie
  • *
  • Posts: 46
    • View Profile
Yellow Snake - w/Source (Updated 10/21)
« Reply #27 on: October 29, 2011, 12:59:30 pm »
Quote from: "Nexus"
I remember one of my first games (or even the first?) was a snake clone, too... At the time I used SDL. My code was horrible, I used a single .cpp file, goto statements and a 500 line main() :D


Thanks for the encouragement, Nexus! My approach started out far more condensed and sloppy (not to claim that my current version isn't sloppy). However, with the help if this thread, I've been able to learn some better techniques, so I must give the credit to those who have helped me here.

I am going to be working today to port this game over to SFML 2.0, because I've begun using it since writing this, and I like it a lot!