How can I create events ?
HI,
Do you know how I can create and event in my game. I mean, when my sprite ( the character ) is in front of object or something (chest,...) and push a button the chest open. Can you tell me how I can do this ? (with DirectX or something)
Thanks
Maduray
------** The power of the newbie is within you **-------
-----** (^_^) **-----
-----** (^_^) **-----
February 20, 2002 05:54 PM
when the user hits a key which is used for opening your chest you have to check if a chest is near the player if so, open it.
quote: Original post by Maduray
Can you tell me how I can do this ? (with DirectX or something)
DirectX is an I/O API, essentially. It doesn''t do game logic. In other words, you''re going to have to handle everything that relates to how your in-game objects interact. An example (in pseudocode):
if(KeyHit(RIGHT)) if(Tile[PlayerPos.X + 1].Passable == false) switch(Tile[PlayerPos.X + 1].Type){ case T_CHEST: Tile[PlayerPos.X + 1].Whatever() //have another switch-case to handle each tile (sprite)''s //responses to environmental action... break //and so on......
Hope that helps a little. It''s not very clear, but if you have any questions, just ask; I''ll keep an eye on this thread.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[if you have a link proposal, email me.]
[twitter]warrenm[/twitter]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement