Touches

jannoman Messages postés 256 Date d'inscription jeudi 17 avril 2003 Statut Membre Dernière intervention 20 février 2008 - 25 mars 2006 à 11:35
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 - 27 mars 2006 à 00:05
salut !

j'ai un petit probleme, pour un jeu que je fais :
on déplace un vaisseau (fleches) et on tire (espace). Le probleme, c'est que quand on fait fleche gauche + fleche haut ca marche, mais fleche gauche + fleche haut + espace ca ne marche pas
j'ai essayé avec getasynckeystate et avec directinput.

A+.
Thomas.

3 réponses

cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
25 mars 2006 à 17:33
Salut
Si tu nous disais :
- dans quel langage
- la composition de ton projet
- comment tu interceptes les touches
- un peu de code ...
Parce que affirmer que ça ne marche pas ne permet pas d'avancer beaucoup

Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

Champion du monde de boule de cristal - 2005
Le savoir est la seule matière qui s'accro
0
jannoman Messages postés 256 Date d'inscription jeudi 17 avril 2003 Statut Membre Dernière intervention 20 février 2008 1
25 mars 2006 à 17:49
langage : VB6.0
interception des touches :

wantu : (bool) fleche du haut,
wantl : idem avec gauche (left), ...

Private Sub savoirtouche()
Static a As Integer, b as integer,c as integer,d as integer,e as integer,f as integer,k as integer
Static g(1 To 8) As Integer

a = 0
b = 0
c = 0
d = 0
f = 0
For k = 1 To 8
g(k) = 0
Next k

wantu = False
wantl = False
wantd = False
wantr = False
wanttofire = False
want_change_weapon = False
For k = 1 To 8
want_weapon(k) = False
Next k

a = GetAsyncKeyState(37) 'gauche
b = GetAsyncKeyState(38) 'haut
c = GetAsyncKeyState(39) 'droite
d = GetAsyncKeyState(40) 'bas
e = GetAsyncKeyState(27) 'Echap
f = GetAsyncKeyState(32) 'Espace
For k = 1 To 8
g(k) = GetAsyncKeyState(48 + k)
Next k

If a <> 0 Then wantl = True
If b <> 0 Then wantu = True
If c <> 0 Then wantr = True
If d <> 0 Then wantd = True
If e <> 0 Then wanttoexit = True
If f <> 0 Then wanttofire = True
For k = 1 To 8
If g(k) <> 0 Then want_weapon(k) True: want_change_weapon True
Next k

End Sub

voila voila
avec directinput



DIDevice.GetDeviceStateKeyboard DIState

wantl = False
wantu = False
wantr = False
wantd = False
wanttofire = False

If DIState.Key(203) 128 Then wantl True
If DIState.Key(200) 128 Then wantu True
If DIState.Key(205) 128 Then wantr True
If DIState.Key(208) 128 Then wantd True
If DIState.Key(1) 128 Then wanttoexit True
If DIState.Key(57) 128 Then wanttofire True
0
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
27 mars 2006 à 00:05
Désolé, je viens de lire.
Je regarde ça demain soir, promis.

Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

Champion du monde de boule de cristal - 2005
0
Rejoignez-nous