Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

im working on my mario game, and i want to make it so that mario speeds up when he presses one of the horizontal arrow keys along with "C"

 

If e.KeyCode = Keys.Left And e.KeyCode = Keys.C Then
           MarioSpeed = 7 'it was originnaly 4, and now its 7
           Mario.MoveLeft(MarioPos.X, MarioSpeed)
           Direction = "left"
End If

 

 

this doesnt seem to be working, is there any way i can do 2 keypress events at once? i tried nested If's but for some reason, i have to press C before pressing Left(or right), so how would i 2 keypress events together?

 

by the way, as an after thought,

for my mario game, what key should be the speedup key

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

  • *Experts*
Posted (edited)

Divil suggested DirectInput so try it. PentiumGuy, you told me you read my introductory tutorial for DirectInput, I dont have to explain eveything if you read it so its easier :). When you process the input check for two keys:

If gameinput.State.Item(Microsoft.DirectX.DirectInput.Key.C) And gameinput.State.Item(Microsoft.DirectX.DirectInput.Key.Right) Then

This seems to do what you need.

Edited by mutant
Posted

oh yeah, i never thought of that thanks

 

thanks to all for helping me

 

i do have one more question though, (mods, u can move this to random thoughts if you want)

 

1) what key should be my speedup key for mario? i have left right and space as movement/jumping. and currently, i have "C" as my speedup key,

 

2) my game's not really a big game, and i dont think windows comes with DirectX. So, the problem is, if it doesnt come with DX, then, i would have to distribute DX to anyone who tries my program :(. would it be recommended to use DX or GetAStncKeyState?

 

thanks in advance

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...