Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Maduray

How can I create events ?

This topic is 6055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 **------- -----** (^_^) **-----

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.]

Share this post


Link to post
Share on other sites
Thanks a lot! It is a great help. Tonight I''ll sleep with a mind wiser

Hmm. can you tell me how the position of the charater in this case can be determined ? Is it a Rect ?

Thanks
Maduray

------** Newbies rules ! **------

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!