Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Game and keys


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2008, 01:51 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Game and keys

Hello
I intend to make a little game, and I wonder what is the best way to move for example a starship with keyboard keys.

Thank you.
__________________
Pascal
Reply With Quote
  #2 (permalink)  
Old 05-14-2008, 01:57 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Use tha Sprite dll, wichcan detect colisions with other sprite objects, and wiht edges or specific coordinates....
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #3 (permalink)  
Old 05-14-2008, 03:25 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Game and keys

Thank you,
Ok I'll use it.
And how do I know which key the player has pressed ?
__________________
Pascal
Reply With Quote
  #4 (permalink)  
Old 05-14-2008, 04:17 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

See this post: D-Pad Navigation Sample (?)
Instead of "If specialKey = ..." you should use
Code:
Select SpeicalKey
 Case cUpKey
  ...
 Case cLeftKey
 ...
 Case cRightKey
 ...
 Case cDownKey
 ...
End Select
Reply With Quote
  #5 (permalink)  
Old 05-14-2008, 05:59 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Game and keys

Ok, that's for the device...
And if I want to make such an application for the desktop ?
Thank you.
__________________
Pascal
Reply With Quote
  #6 (permalink)  
Old 05-14-2008, 06:01 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Them use the keyPress event and use/look for the ASCII key value....
For instance, chr13 is the enter key...
Google a bit and you will find a complete reference to the ASCII key map...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #7 (permalink)  
Old 05-15-2008, 10:24 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

Quote:
Originally Posted by pmu5757 View Post
Ok, that's for the device...
And if I want to make such an application for the desktop ?
Thank you.
It should also work on the desktop.
Reply With Quote
  #8 (permalink)  
Old 06-01-2008, 01:33 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default Game and keys

Ok for the keypressed event and the ascii table.
But what object must I choose for the keypressed event ?
I tried with the whole form, but with a form, I only have the "special keys" of the device.

Thank you

Pascal.
__________________
Pascal
Reply With Quote
  #9 (permalink)  
Old 06-01-2008, 01:45 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

The only two standart control in B4PPc that suport "keyPress Event" are the Button and the Textbox.
Other controls have similar events...

You can change the default event triggered by adding an event...

For instance you want the same code to de used in more than one event, but That would cause too much code lines...
so just add an extra event that will overRide the default event of the control:

AddEvent("Button1",KeyPress,"MySub")
AddEvent("TextBox1",KeyPress,"MySub")

This will cause that both keypress events will be "linking" to the same Sub...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #10 (permalink)  
Old 06-01-2008, 02:37 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 53
Default

Thank you Cableguy, but I still have a question : what are ascii codes for the arrows of the desktop keyboard ?

Thank you.
__________________
Pascal
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ide and arrow keys dennishea Questions & Help Needed 0 09-22-2008 10:45 PM
A little game I put together ...... taximania Share Your Creations 0 12-30-2007 08:48 PM
New game maxtillberg Share Your Creations 1 10-29-2007 10:27 PM
[GAME] Merchants legugusse Share Your Creations 4 07-11-2007 09:36 AM
Game jorgerhv Share Your Creations 0 05-20-2007 01:09 AM


All times are GMT. The time now is 02:02 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0