Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualblack_darkness

Posted 23 December 2012 - 07:16 PM

I think what will benefit you most is to keep logic and rendering separate.

So some psuedo code of what I mean is:
int main(){
	
	//...

	while(running){
		//...
	
		Update();
		Draw();
	}
	
	//...
}

 

 

You want logic/character updates to be handled and then update the character based on what has happened.  Then the character should be drawn to the screen based on that.  Hope that makes sense because that is one of the things that I really struggled with at first.  Nice game so far too smile.png

 

Edit:

 

Another thing I thought that might help you is to decide what each "system" of the game does.  Graphics/Rendering functions probably don't need to know about the character or any of its members, but the character may need to know about these functions to draw to the screen.

 

This is the same for what paradigm said about movement and animation.  Movement needs to know about animation but animation doesn't need to know about movement.  This should help you structure your game a bit better.

I am attempting to structure my game by creating functions right now. I managed to cut the source code in 1/5. (Alot of animation errors but I will fix them later.(I have a backup just in case for refferal or a restart.))  I will have to think on what you said in this thread. Thanks for the responses. I am going to have to be more organized from now on. I have wasted too much time messing with garbled source code. To be honest I have no idea how I would go about  doing logical operations aka animation without drawing each frame every time. I don't really get it.


#1black_darkness

Posted 23 December 2012 - 07:13 PM

I think what will benefit you most is to keep logic and rendering separate.

So some psuedo code of what I mean is:
int main(){
	
	//...

	while(running){
		//...
	
		Update();
		Draw();
	}
	
	//...
}

 

 

You want logic/character updates to be handled and then update the character based on what has happened.  Then the character should be drawn to the screen based on that.  Hope that makes sense because that is one of the things that I really struggled with at first.  Nice game so far too smile.png

 

Edit:

 

Another thing I thought that might help you is to decide what each "system" of the game does.  Graphics/Rendering functions probably don't need to know about the character or any of its members, but the character may need to know about these functions to draw to the screen.

 

This is the same for what paradigm said about movement and animation.  Movement needs to know about animation but animation doesn't need to know about movement.  This should help you structure your game a bit better.

I am attempting to structure my game by creating functions right now. I managed to cut the source code in 1/5. I will have to think on what you said in this thread. Thanks for the responses. I am going to have to be more organized from now on. I have wasted too much time messing with garbled source code. To be honest I have no idea how I would go about  doing logical operations aka animation without drawing each frame every time. I don't really get it.


PARTNERS