Phantom107 Forum

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

Share | 
 

 vk virtual keycodes

Go down 
AuthorMessage
slayer64
Heavy Poster
avatar

Posts : 143
Join date : 2008-01-05

PostSubject: vk virtual keycodes   Wed 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
View user profile
Phantom107
Admin
avatar

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

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

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

Posts : 143
Join date : 2008-01-05

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

that wasnt helpful. lol
Back to top Go down
View user profile
Phantom107
Admin
avatar

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

PostSubject: Re: vk virtual keycodes   Wed 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
View user profile http://phantom107.actieforum.com
slayer64
Heavy Poster
avatar

Posts : 143
Join date : 2008-01-05

PostSubject: Re: vk virtual keycodes   Wed 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
View user profile
Phantom107
Admin
avatar

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

PostSubject: Re: vk virtual keycodes   Wed 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
View user profile http://phantom107.actieforum.com
slayer64
Heavy Poster
avatar

Posts : 143
Join date : 2008-01-05

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

never mind.
Back to top Go down
View user profile
Phantom107
Admin
avatar

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

PostSubject: Re: vk virtual keycodes   Wed 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
View user profile http://phantom107.actieforum.com
Sponsored content




PostSubject: Re: vk virtual keycodes   

Back to top Go down
 
vk virtual keycodes
Back to top 
Page 1 of 1
 Similar topics
-
» How much do you thing I could sell my complete Virtual Boy set for?
» Virtual Dj 6.0.6 Crack Mac Hit
» eshop: GBA Games Arrive On The North American Wii U Virtual Console Starting April 3rd!
» European Virtual Console Set To Explode Back To Life In March!
» Virtual Console: Bonk's Adventure Likely To Release On The Wii U Virtual Console Service This Week In North America

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