ThePentiumGuy Posted July 31, 2003 Posted July 31, 2003 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 Quote 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
*Gurus* divil Posted July 31, 2003 *Gurus* Posted July 31, 2003 Personally I found that using GetAsyncKeyState (that's an API) was the best alternative when I was writing a game loop. I daresay DirectInput is better still, but I don't know it. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
ThePentiumGuy Posted July 31, 2003 Author Posted July 31, 2003 thanks, where would i find API's? i used to be able to do this in VB6, i had a program called API viewer, but not on .NET, but, ill search on google for this API Quote 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
Algar Posted July 31, 2003 Posted July 31, 2003 You can find all the API's you need as well as download the API list/viewer at http://www.allapi.com Quote
*Experts* mutant Posted August 1, 2003 *Experts* Posted August 1, 2003 (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 August 1, 2003 by mutant Quote
ThePentiumGuy Posted August 1, 2003 Author Posted August 1, 2003 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 Quote 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
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.