Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - siatek

Pages: 1 [2] 3 4
16
Bug Reports / Re: variables
« on: 2012-Nov-29 »
mkey ... but im think that its strange becouse its function parametr

so i will do a some kind prefix for global variables ...

17
FAQ / Re: Using pointers for sprites.
« on: 2012-Nov-29 »
Im using global values for sprites (sprName). Im thinking about some kind of textures manager but im using only few atlas textures so im to lazy to ;) to make it :)

about the floats in modern hardware i think that there is no speed advantage of use integeres ? am i wrong ?  (and we have a lot of memory right ;) )

18
Bug Reports / Re: variables
« on: 2012-Nov-29 »
The only one working solution is when i change name "tile" to other for example

FUNCTION isCollisionTile: t
ENDFUNCTION

i think that in this version

FUNCTION isCollisionTile: tile
ENDFUNCTION

or

FUNCTION isCollisionTile: tile%
ENDFUNCTION

compiler thinks that this is global variable, but im think (maybe im wrong) that it shoudnt

cheers

19
Bug Reports / variables
« on: 2012-Nov-28 »
ok i found a strange error i think

in my program i have a GLOBAL variable called tile

TYPE TTile
  width
  height
ENDTYPE

GLOBAL tile as TTile

i have also global variable game as TGame

the TGame TYPE has variable map as TMap
and in the TMap TYPE i have a function:

FUNCTION isCollisionTile: tile%

ENDFUNCTION

and GLBasic think's that the tile% is wrong and its thinking that this is my global tile variable ...

ufff

i think that this is a bug but maybe im wrong ?

regards

20
2D-snippets / Re: platformer
« on: 2012-Nov-28 »
Hi guys thanks for recharge my batteries im very happy you like it ... im working on it in ma free time ... like i said im working on 3rd version of this code its mostly working the same but its made better i think ...

cheers

21
2D-snippets / Re: platformer
« on: 2012-Nov-22 »
Thx ...

actually im rewritting all 3rd time ;)

cheers

22
Code Snippets / Re: Input for beginers
« on: 2012-Nov-22 »
There are 3 ways:

- all constant values and types move to other source file
- remove all stuff kind: SUB __KeysConst__:; ENDSUB (or comment out)
- put main program of top of the first: SUB __KeysConst__:; ENDSUB

im recommendet first one

cheers

ps. im edited this source so now it should work

23
Code Snippets / Re: Input for beginers
« on: 2012-Nov-21 »
achh yes :)
sorry for that
fixed now :)

24
Code Snippets / Input for beginers
« on: 2012-Nov-20 »
Hi this is my input file, the keyboard are about 90% taken from other post on this forum a mouse is made by my self but with keyboard stuff like ... i think that it's usefull for beginners ...

cheers


Code: (glbasic) [Select]


// ------------------------------------------------------------- //
// SUB __CONST_MOUSE_BUTTONS__:; ENDSUB
// ------------------------------------------------------------- //

CONSTANT LMB = 1
CONSTANT RMB = 2
CONSTANT MMB = 3

// ------------------------------------------------------------- //
// SUB __CONST_MOUSE_EVENTS__:; ENDSUB
// ------------------------------------------------------------- //

CONSTANT IS_UP = 0
CONSTANT IS_DOWN = 1
CONSTANT IS_PRESSED = 2
CONSTANT IS_RELEASED = 3

// ------------------------------------------------------------- //
// SUB __KeysConst__:; ENDSUB
// ------------------------------------------------------------- //

CONSTANT vk_escape          = 0x01
CONSTANT vk_1               = 0x02
CONSTANT vk_2               = 0x03
CONSTANT vk_3               = 0x04
CONSTANT vk_4               = 0x05
CONSTANT vk_5               = 0x06
CONSTANT vk_6               = 0x07
CONSTANT vk_7               = 0x08
CONSTANT vk_8               = 0x09
CONSTANT vk_9               = 0x0A
CONSTANT vk_0               = 0x0B
CONSTANT vk_minus           = 0x0C    // - on main keyboard
CONSTANT vk_equals          = 0x0D
CONSTANT vk_back            = 0x0E    // backspace
CONSTANT vk_tab             = 0x0F
CONSTANT vk_q               = 0x10
CONSTANT vk_w               = 0x11
CONSTANT vk_e               = 0x12
CONSTANT vk_r               = 0x13
CONSTANT vk_t               = 0x14
CONSTANT vk_y               = 0x15
CONSTANT vk_u               = 0x16
CONSTANT vk_i               = 0x17
CONSTANT vk_o               = 0x18
CONSTANT vk_p               = 0x19
CONSTANT vk_lbracket        = 0x1A
CONSTANT vk_rbracket        = 0x1B
CONSTANT vk_return          = 0x1C    // Enter on main keyboard
CONSTANT vk_lcontrol        = 0x1D
CONSTANT vk_a               = 0x1E
CONSTANT vk_s               = 0x1F
CONSTANT vk_d               = 0x20
CONSTANT vk_f               = 0x21
CONSTANT vk_g               = 0x22
CONSTANT vk_h               = 0x23
CONSTANT vk_j               = 0x24
CONSTANT vk_k               = 0x25
CONSTANT vk_l               = 0x26
CONSTANT vk_semicolon       = 0x27
CONSTANT vk_apostrophe      = 0x28
CONSTANT vk_grave           = 0x29    // accent grave
CONSTANT vk_lshift          = 0x2A
CONSTANT vk_backslash       = 0x2B
CONSTANT vk_z               = 0x2C
CONSTANT vk_x               = 0x2D
CONSTANT vk_c               = 0x2E
CONSTANT vk_v               = 0x2F
CONSTANT vk_b               = 0x30
CONSTANT vk_n               = 0x31
CONSTANT vk_m               = 0x32
CONSTANT vk_comma           = 0x33
CONSTANT vk_period          = 0x34    // . on main keyboard
CONSTANT vk_slash           = 0x35    // / on main keyboard
CONSTANT vk_rshift          = 0x36
CONSTANT vk_multiply        = 0x37    // * on numeric keypad
CONSTANT vk_lmenu           = 0x38    // left Alt
CONSTANT vk_space           = 0x39
CONSTANT vk_capital         = 0x3A
CONSTANT vk_f1              = 0x3B
CONSTANT vk_f2              = 0x3C
CONSTANT vk_f3              = 0x3D
CONSTANT vk_f4              = 0x3E
CONSTANT vk_f5              = 0x3F
CONSTANT vk_f6              = 0x40
CONSTANT vk_f7              = 0x41
CONSTANT vk_f8              = 0x42
CONSTANT vk_f9              = 0x43
CONSTANT vk_f10             = 0x44
CONSTANT vk_numlock         = 0x45
CONSTANT vk_scroll          = 0x46    // Scroll Lock
CONSTANT vk_numpad7         = 0x47
CONSTANT vk_numpad8         = 0x48
CONSTANT vk_numpad9         = 0x49
CONSTANT vk_subtract        = 0x4A    // - on numeric keypad
CONSTANT vk_numpad4         = 0x4B
CONSTANT vk_numpad5         = 0x4C
CONSTANT vk_numpad6         = 0x4D
CONSTANT vk_add             = 0x4E    // + on numeric keypad
CONSTANT vk_numpad1         = 0x4F
CONSTANT vk_numpad2         = 0x50
CONSTANT vk_numpad3         = 0x51
CONSTANT vk_numpad0         = 0x52
CONSTANT vk_decimal         = 0x53    // . on numeric keypad
CONSTANT vk_oem_102         = 0x56    // < > | on UK/Germany keyboards
CONSTANT vk_f11             = 0x57
CONSTANT vk_f12             = 0x58
CONSTANT vk_f13             = 0x64    //                     (NEC PC98)
CONSTANT vk_f14             = 0x65    //                     (NEC PC98)
CONSTANT vk_f15             = 0x66    //                     (NEC PC98)
CONSTANT vk_kana            = 0x70    // (Japanese keyboard)
CONSTANT vk_abnt_c1         = 0x73    // / ? on Portugese (Brazilian) keyboards
CONSTANT vk_convert         = 0x79    // (Japanese keyboard)
CONSTANT vk_noconvert       = 0x7B    // (Japanese keyboard)
CONSTANT vk_yen             = 0x7D    // (Japanese keyboard)
CONSTANT vk_abnt_c2         = 0x7E    // Numpad . on Portugese (Brazilian) keyboards
CONSTANT vk_numpadequals    = 0x8D    // = on numeric keypad (NEC PC98)
CONSTANT vk_prevtrack       = 0x90    // Previous Track (CONSTANT vk_CIRCUMFLEX on Japanese keyboard)
CONSTANT vk_at              = 0x91    //                     (NEC PC98)
CONSTANT vk_colon           = 0x92    //                     (NEC PC98)
CONSTANT vk_underline       = 0x93    //                     (NEC PC98)
CONSTANT vk_kanji           = 0x94    // (Japanese keyboard)
CONSTANT vk_stop            = 0x95    //                     (NEC PC98)
CONSTANT vk_ax              = 0x96    //                     (Japan AX)
CONSTANT vk_unlabeled       = 0x97    //                        (J3100)
CONSTANT vk_nexttrack       = 0x99    // Next Track
CONSTANT vk_numpadenter     = 0x9C    // Enter on numeric keypad
CONSTANT vk_rcontrol        = 0x9D
CONSTANT vk_mute            = 0xA0    // Mute
CONSTANT vk_calculator      = 0xA1    // Calculator
CONSTANT vk_playpause       = 0xA2    // Play / Pause
CONSTANT vk_mediastop       = 0xA4    // Media Stop
CONSTANT vk_volumedown      = 0xAE    // Volume -
CONSTANT vk_volumeup        = 0xB0    // Volume +
CONSTANT vk_webhome         = 0xB2    // Web home
CONSTANT vk_numpadcomma     = 0xB3    // , on numeric keypad (NEC PC98)
CONSTANT vk_divide          = 0xB5    // / on numeric keypad
CONSTANT vk_sysrq           = 0xB7
CONSTANT vk_rmenu           = 0xB8    // right Alt
CONSTANT vk_pause           = 0xC5    // Pause
CONSTANT vk_home            = 0xC7    // Home on arrow keypad
CONSTANT vk_up              = 0xC8    // UpArrow on arrow keypad
CONSTANT vk_prior           = 0xC9    // PgUp on arrow keypad
CONSTANT vk_left            = 0xCB    // LeftArrow on arrow keypad
CONSTANT vk_right           = 0xCD    // RightArrow on arrow keypad
CONSTANT vk_end             = 0xCF    // End on arrow keypad
CONSTANT vk_down            = 0xD0    // DownArrow on arrow keypad
CONSTANT vk_next            = 0xD1    // PgDn on arrow keypad
CONSTANT vk_insert          = 0xD2    // Insert on arrow keypad
CONSTANT vk_delete          = 0xD3    // Delete on arrow keypad
CONSTANT vk_lwin            = 0xDB    // Left Windows key
CONSTANT vk_rwin            = 0xDC    // Right Windows key
CONSTANT vk_apps            = 0xDD    // AppMenu key
CONSTANT vk_power           = 0xDE    // System Power
CONSTANT vk_sleep           = 0xDF    // System Sleep
CONSTANT vk_wake            = 0xE3    // System Wake
CONSTANT vk_websearch       = 0xE5    // Web Search
CONSTANT vk_webfavorites    = 0xE6    // Web Favorites
CONSTANT vk_webrefresh      = 0xE7    // Web Refresh
CONSTANT vk_webstop         = 0xE8    // Web Stop
CONSTANT vk_webforward      = 0xE9    // Web Forward
CONSTANT vk_webback         = 0xEA    // Web Back
CONSTANT vk_mycomputer      = 0xEB    // My Computer
CONSTANT vk_mail            = 0xEC    // Mail
CONSTANT vk_mediaselect     = 0xED    // Media Select

// ------------------------------------------------------------- //
// SUB __TVec2d__:; ENDSUB
// ------------------------------------------------------------- //

TYPE TVec2d

  x
  y

ENDTYPE


// ------------------------------------------------------------- //
// SUB __TKeyboard__:; ENDSUB
// ------------------------------------------------------------- //

TYPE TKeyboard

gKeyDown[]
gKeyState[]

FUNCTION Create:

self.Destroy()

DIM self.gKeyDown[256]
DIM self.gKeyState[256]

ENDFUNCTION


FUNCTION Update:

LOCAL k

FOR i=0 TO 255

k = KEY(i)

        IF k
            IF self.gKeyDown[i]
                self.gKeyState[i]=IS_DOWN
            ELSE
                self.gKeyDown[i]=IS_DOWN
                self.gKeyState[i]=IS_PRESSED
            ENDIF
        ELSE
            IF self.gKeyDown[i]
                self.gKeyDown[i] = IS_UP
                self.gKeyState[i] = IS_RELEASED
            ELSE
                self.gKeyState[i] = IS_UP
            ENDIF
        ENDIF

NEXT

ENDFUNCTION


FUNCTION GetState: nkey
    RETURN self.gKeyState[nkey]
ENDFUNCTION


FUNCTION Destroy:

DIM self.gKeyDown[0]
DIM self.gKeyState[0]

ENDFUNCTION


ENDTYPE // TKeyboard

// ------------------------------------------------------------- //
// SUB __TMouse__:; ENDSUB
// ------------------------------------------------------------- //

TYPE TMouse

position AS TVec2d

b1_last
b2_last
b3_last

b1_state
b2_state
b3_state

isActive$
isVisible$

FUNCTION Update:

LOCAL b1
LOCAL b2
LOCAL b3

MOUSESTATE self.position.x, self.position.y, b1, b2
b3 = MOUSEAXIS(5)

IF b1

IF self.b1_last = IS_UP
self.b1_state = IS_PRESSED
ELSE
self.b1_state = IS_DOWN
ENDIF

ELSE

IF self.b1_last = IS_DOWN
self.b1_state = IS_RELEASED
ELSE
self.b1_state = IS_UP
ENDIF

ENDIF

self.b1_last = b1



IF b2

IF self.b2_last = IS_UP
self.b2_state = IS_PRESSED
ELSE
self.b2_state = IS_DOWN
ENDIF

ELSE

IF self.b2_last = IS_DOWN
self.b2_state = IS_RELEASED
ELSE
self.b2_state = IS_UP
ENDIF

ENDIF

self.b2_last = b2



IF b3

IF self.b3_last = IS_UP
self.b3_state = IS_PRESSED
ELSE
self.b3_state = IS_DOWN
ENDIF

ELSE

IF self.b3_last = IS_DOWN
self.b3_state = IS_RELEASED
ELSE
self.b3_state = IS_UP
ENDIF

ENDIF

self.b3_last = b3

ENDFUNCTION


FUNCTION GetState: button

SELECT button

CASE LMB
RETURN self.b1_state

CASE RMB
RETURN self.b2_state

CASE MMB
RETURN self.b3_state

ENDSELECT

ENDFUNCTION

ENDTYPE // TMouse


// ------------------------------------------------------------- //
// SUB __MAIN__:; ENDSUB
// ------------------------------------------------------------- //

// this is example code

GLOBAL mouse AS TMouse
GLOBAL keyboard AS TKeyboard

keyboard.Create()

WHILE TRUE //main loop

mouse.Update()
keyboard.Update()

// do some stuff


//example usage:
// IF keyboard.GetState(vk_right) = IS_DOWN THEN do_something_function
// IF mouse.b1 = IS_PRESSED THEN do_something_function_2

SHOWSCREEN

WEND

keyboard.Destroy()


25
2D-snippets / platformer
« on: 2012-Nov-20 »
Hi guys ...
Becouse I'm learn a lot from you, and programming it's my new hobby, I want to thank you all for all answers, tutorials and code snippets that's i found on this forum, and i want to share with you with my old version of platformer game (actually its v3). It's unfinished but there are few features maybe it's will by usefull for somebody somehow ...

regards :)

ps all graphics are from internet



[attachment deleted by admin]

26
FAQ / Re: What is this
« on: 2012-Nov-20 »
Ok thanks :)

@backslider - it's in yours Entity code btw ;)

27
FAQ / What is this
« on: 2012-Nov-20 »
In some sources im finf something like this

@SUB ___MOVEMENT___ :; ENDSUB

is this is empty function for quicker navigation or what ??
and why there is @ ?

regards

28
Off Topic / Re: Where are you from?
« on: 2012-Nov-16 »
Im form Warsaw - Poland

29
Beta Tests / Re: XML
« on: 2012-Nov-04 »
Maybe i'm making something wrong (beware of fast code ;) )

so im share a piece of ugly code :)

regards



[attachment deleted by admin]

30
Beta Tests / Re: XML
« on: 2012-Nov-04 »
hi guys ...

today i made few test's and i think that its a bit slow :/
i'm almost done with my *.tmx to my format converter and map with 3 layers with tiles 32 * 256 took about 45 sek to convert ...

im really really sad :(

regards

ps but i think that this is awesome work becouse its very easy to use ...

Pages: 1 [2] 3 4