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
16
GLBasic - en / Re: Files reading
« on: 2009-Jun-22 »
So sorry, must have forgotten to include it on the last update. Now the file contains a zip of the source too.

... Really sorry but I can't find it again.  :|

17
GLBasic - en / Re: Files reading
« on: 2009-Jun-22 »
My game Worm has a similar way of loading and displaying 2D maps, download and look at the source code and you can see how it's done. Some commands might need adjusting since GL Basic has changed a lot since then though.

http://gamecorner.110mb.com

Thank you, but I can't find any source code in the file.

18
GLBasic - en / Files reading
« on: 2009-Jun-21 »
Hey guys, I don't understand how to read values form files. This is what I'd like to do: I'd like to create a map, for example for a platform game, by writing some values into a .txt file. For example, this would be my map:

0000000000
0000000000
0000000000
0000000000
0000000000
2000000000
1111111111

0, 1 and 2 are squares of different colors (32*32). How can I read this file and draw the correxponding map in the game?

19
Beta Tests / Re: WizSticks
« on: 2009-Feb-06 »
Oh, ok... What a pitty, it seem a good game!

20
Beta Tests / Re: WizSticks
« on: 2009-Feb-06 »
Why only for gp2x wiz? I'd like to try it on my f200... Is this possbile?  :whistle:

21
GLBasic - en / Re: TYPE problem
« on: 2009-Feb-06 »
Ok, thanks a lot, I also needed to write "BREAK" after setting "vspeed=0", to exit the FOR loop. Maybe I'm starting understand something  :whistle:

22
GLBasic - en / Re: TYPE problem
« on: 2009-Feb-05 »
Well, another problem, I was trying to make a simple collision system, but it doesn't work... Here is the code:

Code: (glbasic) [Select]
SETSCREEN 640,480,0

level_state=0


TYPE player
x;y
vspeed
ENDTYPE
GLOBAL pl[] AS player


TYPE blocco
x;y
ENDTYPE
GLOBAL bl[] AS blocco



WHILE KEY(1)=FALSE
IF level_state=0
LOCAL b AS blocco
b.x=0
b.y=240
DIMPUSH bl[],b
LOCAL b2 AS blocco
b2.x=32
b2.y=400
DIMPUSH bl[],b2


LOCAL p AS player
p.x=0
p.y=120
p.vspeed=0
DIMPUSH pl[],p

level_state=1
ENDIF

IF level_state=1
update_player()
ENDIF
SHOWSCREEN
WEND
END


FUNCTION update_player:
FOREACH b IN bl[]
FOREACH p IN pl[]
IF collision_block(p.x,p.y,p.vspeed,b.x,b.y)=0
p.vspeed=5
ELSE
p.vspeed=0
ENDIF
p.y=p.y+p.vspeed
IF KEY(203)
p.x=p.x-3
ENDIF
IF KEY(205)
p.x=p.x+3
ENDIF
DRAWRECT p.x,p.y,32,32,RGB(255,0,0)
NEXT

DRAWRECT b.x,b.y,32,32,RGB(255,255,255)
NEXT
ENDFUNCTION


FUNCTION collision_block: xa, ya, vspeeda, xb, yb
IF(xa>=xb AND xa<=xb+32 AND ya+35+vspeeda>=yb AND ya+vspeeda<=yb+33)
RETURN 1
ELSE
RETURN 0
ENDIF
ENDFUNCTION


The player doesn't stop on the blocks... This works fine if there is only one block, but with 2 blocks the player doesn't stop on them. I'm sorry, I know I'm boring, but I want to learn how to use GL basic well, so I need some helpĀ  :-[

23
GLBasic - en / Re: TYPE problem
« on: 2009-Feb-05 »
Ok, thanks a lot! I'll try a bit now   =D

24
GLBasic - en / Re: TYPE problem
« on: 2009-Feb-05 »
Oh, I think I found out the mistake... I wrote
Code: (glbasic) [Select]
TYPE player
x,y
vspeed
ENDTYPE

I used "x,y" instead of "x;y"... I tried wiritng "x;y" and now it works. Thanks to all! Oh, and another question: can I update player 1 and player 2 (refering to schranz0r's example) even individually, without using FOREACH?

25
GLBasic - en / TYPE problem
« on: 2009-Feb-04 »
Hey guys, i've a little problem (well, in fact it is a great problem).

I am learing how to use types, and i wrote this code:

Code: (glbasic) [Select]
TYPE player
x
y
vspeed
ENDTYPE

Well, it gives me an error: syntax error at line 19 (line 19 is where i worte "TYPE player"). What's wrong with my code? I can't understand.

Oh and i can't even update using the editor, i also get an error doing this, so tomorrow i'll download the last version and i'll try it. Maybe it won't give the error any more, but i just wanted to understand if there was something wrong with my code.

Thanks, and sorry for my english, I'm italian...  :whistle:

26
GLBasic - en / problem with local variables
« on: 2008-Mar-26 »
ow, i didn't solve the problem... i did the same as before... when it come out the IF block, the LOCAL variables don't exists anymore... so i'll use GLOBAL variables... i can't understand how to use LOCALS in my case... if anyone has ideas, please post it thanks :(

27
GLBasic - en / problem with local variables
« on: 2008-Mar-25 »
ow, now it works!! the function was called in a WHILE loop, so every time the variable were declared at the beginning of the function!! i solved the problem with a GLOBAL variable called declared: i wrote
Code: (glbasic) [Select]
if declared=0
LOCAL time
LOCAL score
...
declared=1
ENDIF
so now the variables are declared only 1 time... thanks for the help, the single step mode helped a lot! i feel so stupid now :)... thanks again, bye!

28
GLBasic - en / problem with local variables
« on: 2008-Mar-25 »
the code is in a sub, i tried to put it in a function but i didn't solve anything... i tried to write only this code in a new file, to test it out of my game, but it doesn't work... i added "PRINT time, 100, 100" in the IF phase=2 block, to check if the values were right, but the time goes to 0 when the block starts, and it decrease the time value of 1, then it stops...  so the time value stays to -1... this is strange too... the value should be decreased of 1 over and over again... but it stops... the variable phase is GLOBAL, but if i set it as LOCAL when i release the enter button it returns to phase=1... i used a variable called press to check if the enter key is pressed, if it is pressed the variable has the value 1... this is the code i used:
Code: (glbasic) [Select]
if key(enter) and press=0
phase=2
press=1
ENDIF
so when i press enter the mini-game should start, and should go on without holding the key down... and it shouldn't return to the instructions, right? i don't know why, it doesn't work... it's like the variables assume the value 0 in every new IF block, even if the are delared outside the IF blocks...

29
GLBasic - en / problem with local variables
« on: 2008-Mar-25 »
ok, but why my LOCALs variables don't work if i declare them outside the IF blocks? should i use functions and not subs? or it doesn't matter? i can't understand why if i declare them outside the IF blocks, and then i assign them a value in the IF block(when phase=0), when i go to another IF block they havent the value i assigned... example:

Code: (glbasic) [Select]
LOCAL time
LOCAL score

IF phase=0
time=2000
score=0
phase=1
ENDIF

IF phase=1
//show instructions
if key(enter)
phase=2
ENDIF
ENDIF

IF phase=2
time=time-1
//code for the game
ENDIF
what's wrong this time?

30
GLBasic - en / problem with local variables
« on: 2008-Mar-25 »
oh, okay. but i tried to take them outside the IF block, and to assign them the start value in the first IF block(phase=0)... but it doens't work... so how should i do it? must i use global variables??

Pages: 1 [2] 3 4