Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Game Programming > press the key once


Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2001, 12:55 PM
blursea
Guest
 
Posts: n/a
Question press the key once


i want to press the key G once and mario jumps once, how can i di that

Reply With Quote
  #2  
Old 08-20-2001, 04:31 PM
orufet's Avatar
orufet orufet is offline
Paranoid Coder

Retired Leader
 
Join Date: Mar 2001
Location: Canada
Posts: 2,716
Default Re: press the key once

There are many different ways this can be acomplished. You can detect the KeyCode event for "G", and then have some code for the jump. It really depends on your situation

Jacob Sheehy
http://www.sheehy.ca

"Error, no keyboard — press F1 to continue."
Reply With Quote
  #3  
Old 08-24-2001, 01:03 PM
TommyHM111
Guest
 
Posts: n/a
Default Re: press the key once

blursea... come on. im not trying to be rude (because im not an expert myself) but still. i have given you the code to detect kpress events so many times.. all you have to do is modify it to detect the g event. we do give you alot of help at this forum but we can't write the whole thing (hope i didn't make too many people mad with my post)
Tommy

<font color=white>Scooby </font color=white> <font color=yellow>-Doo </font color=yellow><font color=blue> Where are you? </font color=blue>
Reply With Quote
  #4  
Old 08-24-2001, 01:10 PM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: press the key once

Hey TommyHM111,

Your post is not offensive but it doesn't really add to the thread either...you should probably send Private messages for something like this...

BTW: I'm posting this publicly rather than PMing you because I want to explain this to everybody; it's not just you.




"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #5  
Old 08-24-2001, 01:14 PM
TommyHM111
Guest
 
Posts: n/a
Default Re: press the key once

yes i do agree that it should have been in a private message. Sorry, I don't take offense to what you said, and now after i realized that it didn't add to the thred but blursea the code is
in the keydown event
if keydown = vbkeyG then
'code for mario jumping
endif

<font color=white>Scooby </font color=white> <font color=yellow>-Doo </font color=yellow><font color=blue> Where are you? </font color=blue>
Reply With Quote
  #6  
Old 08-24-2001, 04:07 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default Re: press the key once

A good way to detect keypress is to have your main gaim in a loop with many booleans for a start:

bUp, bDown, bLeft, bRight

in the cub Form_KeyDown, detect the required keypress and set bUp to True. In the KeyUp sub, set it to false. In the main game loop, these Booleans are checked every loop (or infact you can have another boolean which states a change in keypress) and then movement based on that. Putting all your move code within the Form_Keypress event is a little sloppy. [img]images/icons/smile.gif[/img]

__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->