Phantom107 Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Phantom107 Forum

Phantom107's Forum. Discuss about games, GML, 3d, game design here. Enjoy your stay ;)
 
HomeSearchLatest imagesRegisterLog in

 

 vk virtual keycodes

Go down 
2 posters
AuthorMessage
slayer64
Heavy Poster
slayer64


Posts : 143
Join date : 2008-01-05

vk virtual keycodes Empty
PostSubject: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 2:09 am

Code:
draw_text(200,20,chr(vk_down));

all i see on the screen is ( how do i make it say down? without doing this

Code:
if chr(vk_down)='('
draw_text(200,20,'down');

i also need to know how to get joystick buttons. i'm trying to make it so a player can set the controls in my game.
Back to top Go down
Phantom107
Admin
Phantom107


Posts : 206
Join date : 2008-01-03
Location : The Netherlands

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 3:06 pm

Code:
if keyboard_check(vk_down)
draw_text(200,20,"down");
Back to top Go down
https://phantom107.actieforum.com
slayer64
Heavy Poster
slayer64


Posts : 143
Join date : 2008-01-05

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 7:06 pm

that wasnt helpful. lol
Back to top Go down
Phantom107
Admin
Phantom107


Posts : 206
Join date : 2008-01-03
Location : The Netherlands

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 7:11 pm

Quote :
how do i make it say down?

That's exactly what it does. If that wasn't helpful please explain better.
Back to top Go down
https://phantom107.actieforum.com
slayer64
Heavy Poster
slayer64


Posts : 143
Join date : 2008-01-05

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 7:15 pm

it says ")" instead of "down"
i am storing the key codes in a variable.

Code:
global.down=vk_down;

the reason is so that way a player can change the games controls.

Code:
global.down=ord('S');
draw_text(10,10,chr(global.down));

this code displays "S". so i want to know how to get the arrow keys to display "down" "up" "left" "right" not "(" ")" "&" "$"
Back to top Go down
Phantom107
Admin
Phantom107


Posts : 206
Join date : 2008-01-03
Location : The Netherlands

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 7:26 pm

I think that's not the way it works. First you store the desired keypress in a variable.
Code:

key_1 = ord('W');
key_2 = vk_down;

then you just check the variable whenever you want
Code:

if keyboard_check(key_1)
{
//execute code
}

Arguments such as "vk_down", "vk_left" and such aren't strings you can display: they are constants. For example: true = 1. If you use "true" in a string, it will automatically display 1, and not "true".

So if you were to display "down" when the player presses W, execute for example:
(key_1 has been mapped to ord('W'))
Code:

if keyboard_check(key_1)
draw_text(20,20,"down");

Study how the system works and it'll work just fine.
Back to top Go down
https://phantom107.actieforum.com
slayer64
Heavy Poster
slayer64


Posts : 143
Join date : 2008-01-05

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 7:51 pm

never mind.
Back to top Go down
Phantom107
Admin
Phantom107


Posts : 206
Join date : 2008-01-03
Location : The Netherlands

vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitimeWed Jan 09, 2008 11:22 pm

Oh ok..

Quote :

so i want to know how to get the arrow keys to display "down" "up" "left" "right" not "(" ")" "&" "$"
I believe it displays "(" ")" "&" "$ because those are the asci values used for "vk_left", ect...
Back to top Go down
https://phantom107.actieforum.com
Sponsored content





vk virtual keycodes Empty
PostSubject: Re: vk virtual keycodes   vk virtual keycodes Icon_minitime

Back to top Go down
 
vk virtual keycodes
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Phantom107 Forum :: Questions and Answers-
Jump to: