I have trapped the KeyDown event for my program. It detects the keypress properly. What I'd like to do after that is go and refresh the screen, a function called drawGame. The problem is that the keypress function is in frmgame.vb and the drawGame funciton is in clsGameEngine.vb, and the one can't see the other.
Once I've clicked on the screen, the updates I've set in motion work; what I'd like to have is a function similar to the mouseclick, but one which triggers off the pc clock, i.e., refreshing every two seconds or so.
However it does it, it MUST call back to the drawGame function; what I'm unsure of is how to get there from here. Can anyone help?
Actually, (chagrined smile) I answered my own question.
the gameEngine . (dot operator) accessed a few functions already. One of those functions was the one that initialized the game. All I had to do was to make my drawGame function public, and voila! It was available under the dot operator, as follows:
gameEngine.drawGame()
It's important for newbies to understand the mechanics of how one section can call functions in another. Perhaps someone will write a tutorial on this. Thanks!
Bookmarks