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 - bricky91

Pages: 1 2 [3] 4
31
GLBasic - en / problem with local variables
« on: 2008-Mar-24 »
hi, i'm making a game with many mini-games... so i use a sub for each minigame... i have a variable  called game, and i assign a minigame to its values... so i wrote:
Code: (glbasic) [Select]
select game
case 1
gosub minigame1
case 2
gosub minigame2

...
endselect
in every minigame i must have variables, so i defined them local; i have a variable called phase that has values 0,1 or 2:
i wrote in sub minigame 1:
Code: (glbasic) [Select]
if phase=0
//just a loading phase: creates all the variables and arrays or load the sprites...
LOCAL score; score=0
LOCAL time; time=2000
...
phase=1
endif

if phase=1
//show the instructions(here is the code to show the instructions)
if key(28)
phase=2
endif
endif

if phase=2
//play the game(and here's is all the code of the real minigame)
if time<0 then phase=0 //go back to the loading phase and to the instructions if there is no more time
endif
but the LOCAL variables don't work,.. the time should be 2000 at the beginning of the game, and it is 0. so it returns to the instructions... why does it happen? if i define the variables as global variables then it works ok... but if i define them LOCAL the game doesn't work...

32
GLBasic - en / text with some lines
« on: 2008-Mar-24 »
thanks a lot! works great! ::D

33
GLBasic - en / text with some lines
« on: 2008-Mar-23 »
oh, thanks! i didn't see it :)

34
GLBasic - en / text with some lines
« on: 2008-Mar-23 »
hi! is there a function to write a text with more than a line? like this

this is a
text with
3 lines

how can i make this? is there a symbol to put in the PRINT function to stars a new line?
thenks bye!

35
GLBasic - en / FOR problem
« on: 2008-Feb-21 »
hi guys, i have aproblem with this code


Code: (glbasic) [Select]
LOADSPRITE "lana.bmp",0

GLOBAL n_lana
DIM lanax[5]
DIM lanay[5]
DIM lana_xscale[5]
DIM lana_yscale[5]
DIM lana_exists[5]
DIM lana_ricrea[5]

GLOBAL click







WHILE TRUE
GOSUB muovi
SHOWSCREEN
WEND




// ------------------------------------------------------------- //
// ---  MUOVI  ---
// ------------------------------------------------------------- //
SUB muovi:

MOUSESTATE mx,my,b1,b2



IF b1=FALSE
click=0
ENDIF


IF n_lana<4
n_lana=n_lana+1
lanax[n_lana]=RND(640)
lanay[n_lana]=RND(480)
lana_xscale[n_lana]=1
lana_yscale[n_lana]=1
lana_exists[n_lana]=1
lana_ricrea[n_lana]=0
ENDIF


FOR i=1 TO n_lana

lana_yscale[i]=lana_xscale[i]

IF lana_exists[i]=1
IF lana_xscale[i]>0
IF b1 AND click=0
IF mxlanax[i]-32 AND mylanay[i]-32
lana_xscale[i]=lana_xscale[i]-0.1
ENDIF
click=1
ENDIF

ELSE

lana_exists[i]=0
lana_ricrea[i]=120

ENDIF
ENDIF


IF lana_exists[i]=0
lana_ricrea[i]=lana_ricrea[i]-1
ENDIF

IF lana_ricrea[i]<0
lana_ricrea[i]=0
lana_exists[i]=1
lana_xscale[i]=1
ENDIF


ZOOMSPRITE 0,lanax[i]-32,lanay[i]-32,lana_xscale[i],lana_yscale[i]


PRINT lana_exists[i],lanax[i],lanay[i]
PRINT lana_xscale[i],lanax[i]-64,lanay[i]-64

NEXT


DRAWRECT mx,my,10,10,RGB(255,255,255)


ENDSUB // MUOVI
i want 4 sheeps(in this code there isn't any sheep) that go around the scrreen, and i made it... it works fine... now i want the wool of the sheeps, so in the game you have to shear the sheeps... here begins the problem... with the code i wrote, i can shear only the first sheep, and when the first sheep has no wool, i can shear the second... but i don't want to shear the sheeps in order... how can i modify the code so that i can shear the sheep i want? i think the probelm is in the FOR statement... but i can't correct the code...

36
Bug Reports / Smart Phone and LOADBMP problem
« on: 2008-Feb-18 »
thanks a lot, now i can see it :)

bye!

37
Bug Reports / Smart Phone and LOADBMP problem
« on: 2008-Feb-18 »
yeah, here's the link
game.zip - 0.35MB

thanks for the help! :)

38
Bug Reports / Smart Phone and LOADBMP problem
« on: 2008-Feb-17 »
Quote from: Kosta
Quote from: bricky91
the path is correct (the png image is in the same folder of the game...), so i don't know why it doesn't work... to show the image as a background i only have to write LOADBMP "filename", haven't i?
Did you have an Showscreen (at the end of your main-loop or before an keywait)?
of course... i can see all the sprites... i don't know why it doesn't work...

39
Bug Reports / Smart Phone and LOADBMP problem
« on: 2008-Feb-17 »
the path is correct (the png image is in the same folder of the game...), so i don't know why it doesn't work... to show the image as a background i only have to write LOADBMP "filename", haven't i?

40
Bug Reports / Smart Phone and LOADBMP problem
« on: 2008-Feb-17 »
i have the same problem but on windows... i write LOADBMP "sfondo.png", but it doesn't work... it shows only a black screen...

41
Beta Tests / space war
« on: 2008-Feb-08 »
Oh, thanks to everyone for your replies! they'll help me in the new game i'll made... this one was just a game to learn the GL Basic programming language (and this is why i didn't insert any music or Sfx), and i didn't use things like types, or many other things... in the next one i'll probably use types for the enemies, shots and player and learn how to use them properly, i think they're probably better then arrays... anyway, i think make a game with many levels doesn't make sense, because i use the demo version, and the exes can be played only for limited time... i'll do my best to improve the game, and i'll take your advices into account! bye! :)

42
GLBasic - en / load "map"
« on: 2008-Feb-06 »
Quote from: GernotFrisch
Code: (glbasic) [Select]
FUNCTION WriteArray: a[]
OPENFILE 1, "out.bin", false
writelong 1, len(a[])
writelong 1, bounds(a[], 1)
for x=0 to len(a[])-1
   for y=0 to bounds(a[],1)-1
      writeieee 1, a[x][y]
   next
next
closefile 1
endfunction
hi, could you please tell me how it works? i am a noob in glbasic, so i didn't understand really well this code... but i think it could be a useful function.

thanks a lot! bye :)

43
Beta Tests / space war
« on: 2008-Feb-04 »
hi! i made this little space shooter called space war; here's the link:

http://www.zshare.net/download/7200375fc6b51b/

tell me how it is, if you find bugs, and wathever you want! :)

44
GLBasic - en / alignement
« on: 2008-Feb-02 »
thanks moru, and thanks schranz0r! i saw the link to the other topic only now that i've already made it by myself... however, i'm happy to see that i did it like was explained in the topic, so it means i understood well how to do it! thanks again, guys! bye :)

45
GLBasic - en / alignement
« on: 2008-Feb-01 »
Hi! i have another question: is it possible to set the alignement of the text??
thanks bye :)

Pages: 1 2 [3] 4