Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5349

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How do i assign keys (I´m a beginner) Posted by bugget_jr on 19 Mar 2011 at 9:00 AM
Hi! exuce me for my bad english, hope your understand.

I need som help with my school projekt (making 2d fighting game) and i appreciate all help I can get. The programm we use is emarcadero c++ builder. I´m using a VCL forms application to programming in. I´m succeeding to make the character move (picture) using a timer. The problems is that I want to assaign a key for a exampel, so the character move to the right when pressing the key d(or any key but the key d would be best).

I´ve noticed there are like apps for exampel memo called OnKeyPressed but there are no such thing for the timer or the picture, are there any way to go around this?

thanks in advance for any help

Report
Re: How do i assign keys (I´m a beginner) Posted by DaiMitnick on 22 Mar 2011 at 3:32 AM
I would suggest to overcome this problem, and to stop your game having problems later down the line (mainly flickering) that you abandon the pictureboxes now.

You should learn to draw directly on the form, it's not just a lot quicker and more reliable than using pictureboxes, but it also allows you to use the form_keypress event for your controls.

I would recommend reading the small article in the first link to understand the basis of how it works, then use the code in the 2nd link to help guide you to drawing full pictures directly to the form.
HTH, Dai

http://www.ww.functionx.com/bcb/gdi/drawing101.htm

http://www.codeproject.com/KB/graphics/cpicture.aspx



------------------------------------------
Do or do not, there is no try. |
------------------------------------------
Report
Re: How do i assign keys (I´m a beginner) Posted by bugget_jr on 26 Mar 2011 at 8:37 AM
thanks for the help, got it working.
Report
Re: How do i assign keys (I´m a beginner) Posted by bugget_jr on 26 Mar 2011 at 8:39 AM
thanks for the help, got it working.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.