If possible, this should be moved to the Programming forum, didnt realize there was one, oops.
Im working on a current game in c#. Right now I dont really have game events or a game event handler, but thought it would probably be a good idea. Any ideas how I could do this? Possibly using the c# type EventHandler and delegates or something along those lines. . .
Right now to do movement, for example, I have a function which polls the keyboard every gameloop iteration and sets the characters direction/speed based on the keys pressed, then I have another function which animates/moves him based on that, which is also called every loop iteration.
I guess if this were traslated to events, then the keypress/setspeed would be an event that was then handled by some sortof event handler, but how would this event handler have access to information about the player? If the eventhandler was a class, then would all other game information/ class objects have to be instanciated inside it?
Im working on a current game in c#. Right now I dont really have game events or a game event handler, but thought it would probably be a good idea. Any ideas how I could do this? Possibly using the c# type EventHandler and delegates or something along those lines. . .
Right now to do movement, for example, I have a function which polls the keyboard every gameloop iteration and sets the characters direction/speed based on the keys pressed, then I have another function which animates/moves him based on that, which is also called every loop iteration.
I guess if this were traslated to events, then the keypress/setspeed would be an event that was then handled by some sortof event handler, but how would this event handler have access to information about the player? If the eventhandler was a class, then would all other game information/ class objects have to be instanciated inside it?
The post was edited 1 time, last by JamesFord ().