10 Replies - 895 Views - Last Post: 20 April 2012 - 07:01 AM Rate Topic: -----

#1 blacksakura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 12-March 12

retro game remake...need help/review/optimization of code

Posted 18 April 2012 - 08:37 PM

okay I am making a game called Kool Aid Man and was wondering if anyone could lend me a hand figuring a few things out It would be very appreciated. I need help making my sprites disappear and then respawn on collision at the moment all my collision does is detect contact and then push the sprite...i also need to make a 2D array for my pool thing that i will have....

I also was wondering how would i go about making a Timer system...were u get time for hitting and 'killing' enemies if u dont kill them fast enough you run out of time and die..kinda like an old arcade game....


below i have the basic idea of the game and what your meant to do in it..its a remake of an old atari game and i also have link to my current code that i am using which i will later adapt and put into classes which i have already made a template for:

///////////////////////////////////////////////////////////////////////////
This is a clone of the game KoolAid Man from the Atari 2600, with a few adaptations and personal features added.

The aim of the game is to assist KoolAid man in Quenching the thirst of the Thirsties which are trying to steal water from a swimming pool(dont ask me why). KoolAid Man does this by giving the Thirsties KoolAid to drink, he MUST do this before the time limit runs out, or the thirsties drink all the water from the pool!.

KoolAid man can only provide KoolAid when a Thirstie is drinking from the pool (an action indicated by a straw of variable length extending from the Thirsie to the pool) which makes it vunerable to KoolAid mans drink.

If a Thirstie is left unattented its drinking speed will increase draining the pool faster and resulting in player's defeat.Thirstie's who aren't using a straw are dangerous to KoolAid man and will knock him back which in turn will drain time and score from the player.

In order to win a level the player is required to quench a increasing amount of thirsties, which will then take the player to a faster level with more thirstie's to quench. The game is lost either by running out of time, or by losing all of the water in the pool!.

KoolAid Man can obtain power-ups, giving him temporary invincibility allowing him to Quench all thirstie's reguardles of there current status and giving extra points!.



The game Features 3 differant difficulty mode:
Easy mode
This mode has less enemies and more time award.

Normal mode
Will be equal to the orignal games difficulty. (>.<)

Hard mode
will have more enemies,more penatiles,less points and less time awarded!.

The game will end if a player reaches 9001 points or over!.
^^dbz^^

//////////////////////////////////////////////////////////////////////


below is the link to my current code:
http://pastebin.com/V7Zd7bBR

thanks again for taking the time to read this =D

This post has been edited by blacksakura: 18 April 2012 - 08:40 PM


Is This A Good Question/Topic? 0
  • +

Replies To: retro game remake...need help/review/optimization of code

#2 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 03:53 PM

Well you're using the C++ language without taking advantage of its features in OOP and spreading code multiple source files. Also, there is a lot of commented code in there. In all honesty, not sure why you bothered to post this.

For timing, have a look at this code.
Was This Post Helpful? 1
  • +
  • -

#3 blacksakura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 12-March 12

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 04:07 PM

Quote

In all honesty, not sure why you bothered to post this.


well i did state that i had a class template.......perhaps i should of mentioned that it has multiple source files in this is just the out lay of the game i just wanted some advice/ help on a couple of items.....and whats wrong with commenting...it's there to help others reading it understand it better.....
Was This Post Helpful? 0
  • +
  • -

#4 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 04:21 PM

You have comments in function definitions with stuff to do later. There isn't really anything to analyse.
Was This Post Helpful? 1
  • +
  • -

#5 blacksakura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 12-March 12

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 04:35 PM

those comments are like notes for myself....how is that bad...do you remember everything you do on your code every single day?!!!! please teach me if you do..because I cant remember like that so I leave comments for my self as well as other people.....on a proper project I would just leave my notes in the comment section in perforce or what other sharing client I use.


From what i been told commenting is a skill that is desired...to be used so other can quick understand what things do...

This post has been edited by blacksakura: 19 April 2012 - 04:47 PM

Was This Post Helpful? 0
  • +
  • -

#6 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 06:37 PM

Again, I'm not saying comments are bad. I'm saying your comments are bad. If you need so many notes maybe you should consider documenting your code.

Also, again repeating myself, you have provided nothing to analyze! Just globals all over the place in incomplete code. What do you want?
Was This Post Helpful? 1
  • +
  • -

#7 blacksakura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 12-March 12

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 08:37 PM

Quote

What do you want?


Quote

consider documenting your code.

what do you mean....like write psuedo code?

well....

Quote

I need help making my sprites disappear and then respawn on collision at the moment all my collision does is detect contact and then push the sprite...i also need to make a 2D array for my pool thing that i will have....


these are my major problems!

i have no idea how to make a 2D array.....and my collision should make the sprites disappear of the screen and then draw another set after the first one has been killed....to help clear things up a little this is what my sprites should do...http://www.youtube.com/watch?v=nasBarHXf1U....while they are drinking they are vunerable and can be collected by koolaidman...and when there not koolaidman gets pushed back....i dont know how to make the 2 different sets of collision work with each other.....so to answer your question.. i want help with the collision mainly and the 2D array.. hope this clear things up sorry for being misleading

This post has been edited by blacksakura: 19 April 2012 - 08:39 PM

Was This Post Helpful? 0
  • +
  • -

#8 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 09:05 PM

Okay, I'm going to say this as clearly as possible, and I hope you don't take offense: You are nowhere near ready to tackle programming games. Your understanding of C++ is minimal and needs to be drastically improved in order to even start thinking about writing games. For me to tell you exactly what is wrong with you code is a waste of both our time, as you will keep firing questions at me because you have no idea what I'm talking about. This is demonstrated by your last post.

If you are prepared to put in the time and effort to learn language fundamentals first, I can't see why you couldn't move on to attempting games. As things stand at the moment you are a very, very weak programmer who should not be even thinking about games yet. Why? As said you need to first make yourself a strong programmer. Plus, you attempting a game in C++ is frankly insane.

You can't do it right now unless you copy someone else's project.

Please learn the basics and not expect others to teach you. This is a help and not formal teaching forum.

I hope I have made myself clear.

This post has been edited by ButchDean: 19 April 2012 - 09:07 PM

Was This Post Helpful? 0
  • +
  • -

#9 blacksakura  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 12-March 12

Re: retro game remake...need help/review/optimization of code

Posted 19 April 2012 - 09:41 PM

Unfortunately I know that you are right about my skill level and I am working on the basic more to get better at it but at the moment I don't have a choice in the matter as I am stuck into a course for the reset of the year with a huge debt..and I could drop out but that leaves me 16 grand down so I have to seek help everywhere I can on top of my university hours I also have a tutor to help me and I patrol several forums for help and spend huge amount of time watching tutorials. so as I stand I am stuck.

so I will endeavour with my project despite my lack of knowledge.
Was This Post Helpful? 0
  • +
  • -

#10 Celerian  Icon User is offline

  • D.I.C Regular


Reputation: 144
  • View blog
  • Posts: 384
  • Joined: 30-March 12

Re: retro game remake...need help/review/optimization of code

Posted 20 April 2012 - 05:51 AM

What ButchDean is saying is that what you do have in the way of code isn't very clean. You have 3 colored sprites (I'm guessing the Thirsties) that the only difference in the code appears to be the color of the sprite. So, to do one or two functions, you repeat code three times. Instead, you could make a Thirstie class that has this code in it. When your game loads, it would create three instances of the Thirstie class (Blue, Purple, Orange). From there, you could call the DrawSprite and StrawLength code, and check for collisions.

Your comments aren't as bad as he would lead you to believe. One of them was mislabeled (OrangeCollision comment was labeled as PurpleCollision) and some of it extra (designs around your variables) that wasn't really helpful.

It appears your biggest obstacles right now are getting your timers right and learning arrays. Normally, a game will have a game loop that handles screen redraw, high scores, player input. There are some pretty good tutorials floating around here that deal with setting up the game loop and optimizing it for running at a high framerate.

As for the array, you're just going to have to crack open a book and learn how to use them. I could explain to you the basics of an array, how to initialize it and use it, but I cannot give you a practical implementation since I honestly have no idea what you want the array for (something about a pool?).

Sorry I couldn't be of more help. If this is a school project, have you asked your professor for some assistance as far as the concepts and structures that you don't seem to be familiar with?
Was This Post Helpful? 0
  • +
  • -

#11 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: retro game remake...need help/review/optimization of code

Posted 20 April 2012 - 07:01 AM

View PostCelerian, on 20 April 2012 - 01:51 PM, said:

What ButchDean is saying is that what you do have in the way of code isn't very clean.

No, I'm saying it's not good code. It doesn't do anything nor offer a reliable architecture to build any game on!

View PostCelerian, on 20 April 2012 - 01:51 PM, said:

Your comments aren't as bad as he would lead you to believe.

I'm not leading blacksakura to believe commenting is bad at all! Just that people normally comment working code to give a description of its functionality, and there is no code there to describe. That's my point.

You too have misinterpreted what I'm saying.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1