Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Is this good for start off an project?

Author
Message
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 11th Apr 2009 22:11
hej i started with my new fps and i newer use enume before so i wonder if thiss looks ok.


Game.Love
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 11th Apr 2009 22:49 Edited at: 11th Apr 2009 22:50
Ya, that looks pretty good. I don't see any intialization--typically I have four (sometimes five) functions for each component of my game:

-Init(): This function is called once at the beginning of the game. It typically loads/creates all the media, creates any global variables and arrays, and initializes all the data.

-Reset(): This function sets all the data (such as the player's health, his items, etc) to their default values, and is called each time the game itself is started/restarted. For instance if you were in the middle of a game then you went to the pause menu and restarted this function would be called to reset everything.

-Update(): This function (obviously) updates the component--not much needs to be said about it.

-ShutDown(): In DBP this function is less important because everything is cleaned up for you but in C++ I like to code in a much cleaner fashion, so I use this for all my un-initialization, and it's called once right when the application is closed.

-Sometimes I have an 'OnSetDisplayMode' function is called each time the user switches display modes, and it simply re-loads all the media.

So here's what some pseudo-code would look like for a simple game:



i like orange
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 11th Apr 2009 22:53
mhm...good ideas andrewt i also thad of a fuction that deletes all the media if u want to go to the menu=!

Game.Love

Login to post a reply

Server time is: 2024-09-30 23:21:00
Your offset time is: 2024-09-30 23:21:00