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, 12:51 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
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, 12:57 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,008
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
Reply With Quote
  #3 (permalink)  
Old 05-14-2008, 02:25 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
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, 03:17 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,572
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, 04:59 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
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, 05:01 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,008
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
Reply With Quote
  #7 (permalink)  
Old 05-15-2008, 09:24 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,572
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, 12:33 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
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, 12:45 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,008
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
Reply With Quote
  #10 (permalink)  
Old 06-01-2008, 01:37 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
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
Trapping Other Keys Louis Questions & Help Needed 3 05-10-2008 07:20 AM
Using hw keys in MS Smartphone TomasNM Questions & Help Needed 4 02-25-2008 03:30 PM
Soft Keys on Smart Phones? Louis Questions & Help Needed 1 02-21-2008 05:49 AM
Capturing the arrow keys on the desktop Louis Questions & Help Needed 1 08-31-2007 09:01 PM
Menu handling with hardware keys miklquick Questions & Help Needed 8 07-13-2007 06:58 PM


All times are GMT. The time now is 04:07 AM.


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