RetroBASIC
Retrogamecoding(.org) => EGSL => Topic started by: pielago on July 08, 2013, 10:12:47 AM
-
Hi I am new to this EGSL but so far I love it :)
but have also a few questions and also wish someone could help me with it :)
here it goes:
1.. I want to do camera(player) follow how do I do it????
2..I see keyboard action but to code it??? how can I tell the numbers for each key?
if keystate (275) then
player.x=player.x+1
end
how can I tell the numbers for each key? IF i want to use like ("d") or ("u") or any????
3..I come from (NOT PRO but in process )love and corona sdk and they use also lua yay! BUT I was able to use external modules functions.. now
how do you do it here? any tutorial as an advise???
4..once the game is done how can I compile it? so i can send it to any other pc or device or etc ?????
If someone could give me any type of clue ill be so happy :) so far IDK why but this program is nice to use and i want to get
the opportunity to make a cool game :)
-
You can start by looking here ->http://egsl.retrogamecoding.org/documentation/ (http://egsl.retrogamecoding.org/documentation/)
and http://egsl.retrogamecoding.org/ (http://egsl.retrogamecoding.org/)
And also old forum very usefull -> http://retrogamecoding.org/forum/index.php?page=Index (http://retrogamecoding.org/forum/index.php?page=Index)
some keys:
k_esc = 27
k_up = 273
k_down = 274
k_right = 275
k_left = 276
-
SDLK_UNKNOWN = 0;
SDLK_FIRST = 0;
SDLK_BACKSPACE = 8;
SDLK_TAB = 9;
SDLK_CLEAR = 12;
SDLK_RETURN = 13;
SDLK_PAUSE = 19;
SDLK_ESCAPE = 27;
SDLK_SPACE = 32;
SDLK_EXCLAIM = 33;
SDLK_QUOTEDBL = 34;
SDLK_HASH = 35;
SDLK_DOLLAR = 36;
SDLK_AMPERSAND = 38;
SDLK_QUOTE = 39;
SDLK_LEFTPAREN = 40;
SDLK_RIGHTPAREN = 41;
SDLK_ASTERISK = 42;
SDLK_PLUS = 43;
SDLK_COMMA = 44;
SDLK_MINUS = 45;
SDLK_PERIOD = 46;
SDLK_SLASH = 47;
SDLK_0 = 48;
SDLK_1 = 49;
SDLK_2 = 50;
SDLK_3 = 51;
SDLK_4 = 52;
SDLK_5 = 53;
SDLK_6 = 54;
SDLK_7 = 55;
SDLK_8 = 56;
SDLK_9 = 57;
SDLK_COLON = 58;
SDLK_SEMICOLON = 59;
SDLK_LESS = 60;
SDLK_EQUALS = 61;
SDLK_GREATER = 62;
SDLK_QUESTION = 63;
SDLK_AT = 64;
SDLK_LEFTBRACKET = 91;
SDLK_BACKSLASH = 92;
SDLK_RIGHTBRACKET = 93;
SDLK_CARET = 94;
SDLK_UNDERSCORE = 95;
SDLK_BACKQUOTE = 96;
SDLK_a = 97;
SDLK_b = 98;
SDLK_c = 99;
SDLK_d = 100;
SDLK_e = 101;
SDLK_f = 102;
SDLK_g = 103;
SDLK_h = 104;
SDLK_i = 105;
SDLK_j = 106;
SDLK_k = 107;
SDLK_l = 108;
SDLK_m = 109;
SDLK_n = 110;
SDLK_o = 111;
SDLK_p = 112;
SDLK_q = 113;
SDLK_r = 114;
SDLK_s = 115;
SDLK_t = 116;
SDLK_u = 117;
SDLK_v = 118;
SDLK_w = 119;
SDLK_x = 120;
SDLK_y = 121;
SDLK_z = 122;
SDLK_DELETE = 127;
// Numeric keypad
SDLK_KP0 = 256;
SDLK_KP1 = 257;
SDLK_KP2 = 258;
SDLK_KP3 = 259;
SDLK_KP4 = 260;
SDLK_KP5 = 261;
SDLK_KP6 = 262;
SDLK_KP7 = 263;
SDLK_KP8 = 264;
SDLK_KP9 = 265;
SDLK_KP_PERIOD = 266;
SDLK_KP_DIVIDE = 267;
SDLK_KP_MULTIPLY = 268;
SDLK_KP_MINUS = 269;
SDLK_KP_PLUS = 270;
SDLK_KP_ENTER = 271;
SDLK_KP_EQUALS = 272;
// Arrows + Home/End pad
SDLK_UP = 273;
SDLK_DOWN = 274;
SDLK_RIGHT = 275;
SDLK_LEFT = 276;
SDLK_INSERT = 277;
SDLK_HOME = 278;
SDLK_END = 279;
SDLK_PAGEUP = 280;
SDLK_PAGEDOWN = 281;
// Function keys
SDLK_F1 = 282;
SDLK_F2 = 283;
SDLK_F3 = 284;
SDLK_F4 = 285;
SDLK_F5 = 286;
SDLK_F6 = 287;
SDLK_F7 = 288;
SDLK_F8 = 289;
SDLK_F9 = 290;
SDLK_F10 = 291;
SDLK_F11 = 292;
SDLK_F12 = 293;
SDLK_F13 = 294;
SDLK_F14 = 295;
SDLK_F15 = 296;
// Key state modifier keys
SDLK_NUMLOCK = 300;
SDLK_CAPSLOCK = 301;
SDLK_SCROLLOCK = 302;
SDLK_RSHIFT = 303;
SDLK_LSHIFT = 304;
SDLK_RCTRL = 305;
SDLK_LCTRL = 306;
SDLK_RALT = 307;
SDLK_LALT = 308;
SDLK_RMETA = 309;
SDLK_LMETA = 310;
SDLK_LSUPER = 311; // Left "Windows" key
SDLK_RSUPER = 312; // Right "Windows" key
SDLK_MODE = 313; // "Alt Gr" key
SDLK_COMPOSE = 314; // Multi-key compose key
// Miscellaneous function keys
SDLK_HELP = 315;
SDLK_PRINT = 316;
SDLK_SYSREQ = 317;
SDLK_BREAK = 318;
SDLK_MENU = 319;
SDLK_POWER = 320; // Power Macintosh power key
SDLK_EURO = 321; // Some european keyboards
It is the same as SDL so the keys are the same, look thru the links I gave you and it is based on lua so you can do like in strict lua programming.
-
First link was false, correct is: http://egsl.retrogamecoding.org/documentation/egsldocumentation.html
-
Using external modules is like in Lua. Let's assume you have that Lua script
function add (x,y)
return x+y
end
saved as "adding.lua". Then put it in the same path as your main script. In your main script do
require "adding"
and use the function as e.g.
add (5,9)
or to see the result
drawtext (0,0,add(5,9))
-
If it is so easy, why it is not part of the documentation at all?
i have added the Keys into the EGSL Documentation in EGSL IDE for Haiku (Without SDL before).
Key Numbers
Like in SDL
K_UNKNOWN = 0;
K_FIRST = 0;
K_BACKSPACE = 8;
K_TAB = 9;
K_CLEAR = 12;
K_RETURN = 13;
K_PAUSE = 19;
K_ESCAPE = 27;
K_SPACE = 32;
K_EXCLAIM = 33;
K_QUOTEDBL = 34;
K_HASH = 35;
K_DOLLAR = 36;
K_AMPERSAND = 38;
K_QUOTE = 39;
K_LEFTPAREN = 40;
K_RIGHTPAREN = 41;
K_ASTERISK = 42;
K_PLUS = 43;
K_COMMA = 44;
K_MINUS = 45;
K_PERIOD = 46;
K_SLASH = 47;
K_0 = 48;
K_1 = 49;
K_2 = 50;
K_3 = 51;
K_4 = 52;
K_5 = 53;
K_6 = 54;
K_7 = 55;
K_8 = 56;
K_9 = 57;
K_COLON = 58;
K_SEMICOLON = 59;
K_LESS = 60;
K_EQUALS = 61;
K_GREATER = 62;
K_QUESTION = 63;
K_AT = 64;
K_LEFTBRACKET = 91;
K_BACKSLASH = 92;
K_RIGHTBRACKET = 93;
K_CARET = 94;
K_UNDERSCORE = 95;
K_BACKQUOTE = 96;
K_a = 97;
K_b = 98;
K_c = 99;
K_d = 100;
K_e = 101;
K_f = 102;
K_g = 103;
K_h = 104;
K_i = 105;
K_j = 106;
K_k = 107;
K_l = 108;
K_m = 109;
K_n = 110;
K_o = 111;
K_p = 112;
K_q = 113;
K_r = 114;
K_s = 115;
K_t = 116;
K_u = 117;
K_v = 118;
K_w = 119;
K_x = 120;
K_y = 121;
K_z = 122;
K_DELETE = 127;
// Numeric keypad
K_KP0 = 256;
K_KP1 = 257;
K_KP2 = 258;
K_KP3 = 259;
K_KP4 = 260;
K_KP5 = 261;
K_KP6 = 262;
K_KP7 = 263;
K_KP8 = 264;
K_KP9 = 265;
K_KP_PERIOD = 266;
K_KP_DIVIDE = 267;
K_KP_MULTIPLY = 268;
K_KP_MINUS = 269;
K_KP_PLUS = 270;
K_KP_ENTER = 271;
K_KP_EQUALS = 272;
// Arrows + Home/End pad
K_UP = 273;
K_DOWN = 274;
K_RIGHT = 275;
K_LEFT = 276;
K_INSERT = 277;
K_HOME = 278;
K_END = 279;
K_PAGEUP = 280;
K_PAGEDOWN = 281;
// Function keys
K_F1 = 282;
K_F2 = 283;
K_F3 = 284;
K_F4 = 285;
K_F5 = 286;
K_F6 = 287;
K_F7 = 288;
K_F8 = 289;
K_F9 = 290;
K_F10 = 291;
K_F11 = 292;
K_F12 = 293;
K_F13 = 294;
K_F14 = 295;
K_F15 = 296;
// Key state modifier keys
K_NUMLOCK = 300;
K_CAPSLOCK = 301;
K_SCROLLOCK = 302;
K_RSHIFT = 303;
K_LSHIFT = 304;
K_RCTRL = 305;
K_LCTRL = 306;
K_RALT = 307;
K_LALT = 308;
K_RMETA = 309;
K_LMETA = 310;
K_LSUPER = 311; // Left "Windows" key
K_RSUPER = 312; // Right "Windows" key
K_MODE = 313; // "Alt Gr" key
K_COMPOSE = 314; // Multi-key compose key
// Miscellaneous function keys
K_HELP = 315;
K_PRINT = 316;
K_SYSREQ = 317;
K_BREAK = 318;
K_MENU = 319;
K_POWER = 320; // Power Macintosh power key
K_EURO = 321; // Some european keyboards
-
thank you all wonderful answers :)
but Cybermonkey? :o
is it possible to turn the external function into a variable ?
----------------
new.lua
local t = 1
function try()
t = t+1
end
----------------
require "new"
local m = try()
Can I work the variable like that???
sorry i am pretty new at this! I kind of played with corona sdk for alil while so yea (wonder if close to it?)
-
is it possible to turn the external function into a variable ?
----------------
new.lua
local t = 1
function try()
t = t+1
end
----------------
require "new"
local m = try()
Can I work the variable like that???
I'm not sure what you want to achieve, but the good news is that both things are possible. If you want to get a result from the function you need to pass value and then use return():
new.lua
local t = 1
function try()
t = t+1
return(t)
end
----------------
require "new"
local m = try([value])
If you want to create an alias for the function, you shouldn't use ():
local m = try
Hope, it helps. :)