Menu

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.

Show posts Menu

Topics - siatek

#1
After playing with Godot engine and watching CalumK Tutorial im decided to make this one in GLBasic
cheers ...

inspired by: http://calumk.com/SpaceShooter/
graphics: http://www.kenney.nl/
sounds: http://www.freesound.org
#2
Hi

It is fast coded application (very very simple)
but its useful for me in Cardio Training, maybe this could be useful for someone ...

I'm include a source code ...

regards ...


red - you have a 15 sec breake
green - you have heavy cardio like excersise
blue - you are finished yours cardio training

good luck ;)
#3
FAQ / box2d 2.2.1
2012-Nov-30
In my project im using wrapper found in this forum, its very old box2d version where many of features are missed ...
I'm not c programmer and my trying to make a new wrapper but without help is like a joke becouse im to dump for that ...
But with little help i can try, or maybe somebody has working version of new box2d lib ???

regards
#4
Bug Reports / variables
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
#5
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()

#6
2D-snippets / platformer
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]
#7
FAQ / What is this
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
#8
Hi a i have a little question:

here is an example code:

Code (glbasic) Select

TYPE TMap

position AS TVec2d
width
height

layers[] AS TLayer

  FUNCTION Create:

DIM self.layers[10]

FOREACH layer IN self.layers[]
layer.Create()
NEXT

ENDFUNCTION

FUNCTION Destroy:

FOREACH layer IN self.layers[]
layer.Destroy()
NEXT

DIM self.layers[0]

ENDFUNCTION

ENDTYPE // TMap

//////////////////////////////////////

TYPE TLayer

position AS TVec2d

entities[] AS TEntity

isVisible

FUNCTION Create:

self.Destroy()

ENDFUNCTION


FUNCTION Destroy:

DIM self.entities[0]

ENDFUNCTION


FUNCTION AddEntity: entity AS TEntity

DIMPUSH self.entities[], entity

ENDFUNCTION

ENDTYPE // TLayer


and now is the question:

is function Destroy in TYPE TMap shoud be:

Code (glbasic) Select
FUNCTION Destroy:

FOREACH layer IN self.layers[]
layer.Destroy()
NEXT

DIM self.layers[0]

ENDFUNCTION



or

Code (glbasic) Select
FUNCTION Destroy:

DIM self.layers[0]

ENDFUNCTION


is good enought ??

regards

#9
Hi

I'm add this to a wrapper but it's doesn't working ... there is no "type" member it saying ... but in box2d documentation it written that this shoud work :/ (def.type = b2_kinematicBody;)

anybody could help ??

regards

Code (glbasic) Select
FUNCTION b_CreateKinematicPoly_ext: x, y, friction, pts[]

INLINE
b2BodyDef def;
def.type = b2_kinematicBody;
def.position.Set((float)x, (float)y);

b2Body* kinematic = bWorld->CreateBody(&def);

b2PolygonDef kinematicshapedef;
kinematicshapedef.vertexCount = LEN(pts);
for(int i=0; i<LEN(pts); ++i)
{
kinematicshapedef.vertices[i] = b2Vec2(pts(i,0), pts(i,1));
}

kinematicshapedef.friction = friction;
kinematic->CreateShape(&kinematicshapedef);
return b_NewObject(kinematic,bBody);
ENDINLINE

ENDFUNCTION
#10
Hi guys ...

I couldn't find a newest IDE there is an info that the current version is 10.231 but in download section is 10.202 ??

Somebody could help ??

cheers
#11
Announcements / platformer
2012-May-25
Hi guys ...
I'd like to share with you my first steps in glbasic ...
I'm not a programmer but I work in the game industry as a 3d artist ...
This prototype was the game after work, where I learned glbasic ... it took me about 3 weeks ...
Currently the game is still platfomer but another kind
Splits really a lot of code and frame what you show, but it is three months older
I hope you enjoy what I have achieved, I am very happy because it really gives me a lot of fun ...

Keep your fingers crossed, the current game schedule should appear on the IOS in February 2013

ps The particle system of MrTAToad have just been added ... thx and cheers

All Sprites have been borrowed from the lost of vikings and mario all rights belong to respective creators

https://www.dropbox.com/s/f5yng1sdmfi8wj3/old.ZIP
#12
this is a file format exported from "tiled" editor
there must be exactly 3 standard layers: object, collision and background
you can expand this easy ...

cheers

Code (glbasic) Select


// ------------------------------------------------------------- //
// ---  TFlareFile  ---
// ------------------------------------------------------------- //

TYPE TFlareFile

backgroundLayer%[]
collisionLayer%[]
objectLayer%[]

width%
height%

FUNCTION Load: filename$

LOCAL chn% = GENFILE()
LOCAL buffer$

IF OPENFILE(chn, filename$, 1) = FALSE THEN END

READLINE chn, buffer$
READLINE chn, buffer$
buffer$ = LTRIM$ (buffer$,"width=")
self.width = INTEGER(buffer$)

READLINE chn, buffer$
buffer$ = LTRIM$ (buffer$,"height=")

self.height = INTEGER(buffer$)

DIM self.backgroundLayer[self.width][self.height]
DIM self.collisionLayer[self.width][self.height]
DIM self.objectLayer[self.width][self.height]

LOCAL x%

READLINE chn, buffer$
READLINE chn, buffer$
READLINE chn, buffer$
READLINE chn, buffer$

FOR y = 0 TO self.height-1
x=0
buffer$ = self.zReadLine$(chn)
LOCAL tiles$[]
SPLITSTR (buffer$, tiles$[], ",")
FOREACH tile IN tiles$[]
self.backgroundLayer[x][y] = INTEGER (tile)
INC x
NEXT
NEXT

READLINE chn, buffer$
READLINE chn, buffer$
READLINE chn, buffer$
READLINE chn, buffer$

FOR y = 0 TO self.height-1
x=0
buffer$ = zReadLine$(chn)
LOCAL tiles$[]
SPLITSTR (buffer$, tiles$[], ",")
FOREACH tile IN tiles$[]
self.collisionLayer[x][y] = INTEGER (tile)
INC x
NEXT
NEXT

READLINE chn, buffer$
READLINE chn, buffer$
READLINE chn, buffer$
READLINE chn, buffer$

FOR y = 0 TO self.height-1
x=0
buffer$ = self.zReadLine$(chn)
LOCAL tiles$[]
SPLITSTR (buffer$, tiles$[], ",")
FOREACH tile IN tiles$[]
self.objectLayer[x][y] = INTEGER (tile)
INC x
NEXT
NEXT

CLOSEFILE chn

ENDFUNCTION

FUNCTION zReadLine$: chn
LOCAL chda$, L$=""
REPEAT
    IF ENDOFFILE(chn) THEN BREAK
    READSTR chn, chda$, 1
    L$=L$+chda$
UNTIL ASC(chda$)=10
L$=TRIM$(L$)
RETURN L$
ENDFUNCTION

ENDTYPE
#13
im really newbie but maybe its usefull for somebody ...

Quote

TYPE TAnimation

   firstFrame%
   lastFrame%
   currentFrame%
   delay%
   tick%

   FUNCTION SetLoop: first%, last%
      self.firstFrame = first
      self.lastFrame = last
   ENDFUNCTION


   FUNCTION SetDelay: delay%
      self.delay = delay
   ENDFUNCTION


   FUNCTION Reset:
      self.currentFrame = self.firstFrame
   ENDFUNCTION


   FUNCTION Update:

      IF self.tick > self.delay
         self.tick = 0
         INC self.currentFrame
      ENDIF

      IF self.currentFrame > self.lastFrame THEN self.currentFrame = self.firstFrame
      IF self.currentFrame < self.firstFrame THEN self.currentFrame = self.firstFrame

      INC self.tick

   ENDFUNCTION


   FUNCTION Finished:
      IF self.currentFrame = self.lastFrame
         RETURN TRUE
      ELSE
         RETURN FALSE
      ENDIF
   ENDFUNCTION


   FUNCTION Start:
      IF self.currentFrame = self.firstFrame
         RETURN TRUE
      ELSE
         RETURN FALSE
      ENDIF
   ENDFUNCTION

ENDTYPE

example usage

somewhere in "update":

Quote

self.animation.Update()

   IF self.isFiring

      self.animation.SetLoop(8, 15)
      self.animation.SetDelay(10)

      IF self.animation.Finished() THEN Something()

   ENDIF


somewhere in draw:

QuoteDRAWANIM sprHelloKitty, self.animation.currentFrame, self.position.x, self.position.y