BASIC

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

Pages: [1] 2
1
GLBasic - en / Re: array use?
« on: 2012-Jun-09 »
Thanks for the posts. The help is much appreciated!

2
GLBasic - en / Re: array use?
« on: 2012-Jun-08 »
Well I found i bit of Basic code to do what I want but I can't seem to get it to work. Here is what I have. Any ideas?

Code: GLBasic [Select]
GLOBAL BlockColor[];DIM BlockColor[7][3]//rgb colors(1-3) for each of the seven pieces

FOR iter = 0 TO 6 //loop through seven pieces
        READ BlockColor[iter][0]//read red amount
        READ BlockColor[iter][1]//read green amount
        READ BlockColor[iter][2]//read blue amount
NEXT
       
DATA 255,255,0//yellow square
DATA 0,128,255//turquoise line
DATA 0,0,255//blue left L
DATA 255,128,0//orange right L
DATA 255,0,0//red left S
DATA 0,255,0//green right S
DATA 128,0,255//purple T

3
GLBasic - en / Re: array use?
« on: 2012-Jun-08 »
OK. Another question if you don't mind. I have obrick[4][4] I plan to fill it like...
0000
0110
0110
0000

Is their a faster way to do that than using:
obrick[0][0]=0
obrick[0][1]=0
...

Thanks for the help.

4
Very cool. Maybe by this time next year I will be up to joining, myself.  :D

5
GLBasic - en / array use?
« on: 2012-Jun-07 »
For my falling blocks game I figure I can store the block locations for my seven shapes in a 4x4 array. Do I need to make an array for all seven or is their a more efficient way to store the data?

6
Nice articles Slydog. I think I will take it's advice and build some simple games to get the process down. I will start with a tetris clone.  :)

7
I will start small for now. I am working with sprite strips for now and will go from their.

8
Good idea. Guess I will start with the over world tile map. Seems like mappy is the tool to use around here. I am gonna grab the wrapper and see what I can make of it.

9
GLBasic - en / New to programming, what next?
« on: 2012-Jun-04 »
Hello. I am new to programming and really enjoying GLB. I have finished the help file tutorials and now considering what to read next. My ultimate goal is to make a new strategy rpg that plays like shining force 2. If you can recommend any tutorials or reading to get closer to that goal I would appreciate it.

10
GLBasic - en / Re: Pong help.
« on: 2012-Jun-04 »
Wow, lots of replys. Thanks.
@erico That local was exactly the problem I was looking for! Everything works fine now.

@Slydog I will look at those changes and see what I can learn. Thank you.

11
GLBasic - en / Re: Pong help.
« on: 2012-Jun-04 »
I am talking about the Pong that I built with the written tutorial not the pre-built samples. It does not start.

12
GLBasic - en / Pong help.
« on: 2012-Jun-04 »
I have worked through the Pong tutorial and the ball won't move. I can't seem to find what is wrong. Any help would be appreciated.
Code: GLBasic [Select]
// --------------------------------- //
// Project: Pong
// Start: Monday, June 04, 2012
// IDE Version: 10.202


GLOBAL bat_y[];DIM bat_y[2]
GLOBAL bat_x[];DIM bat_x[2]
GLOBAL score[];DIM score[2]
GLOBAL ball_x,ball_y,ball_sx,ball_sy,col

GOSUB Init
MainLoop:
        GOSUB MoveAll
        GOSUB ShowAll
GOTO MainLoop
       



// ------------------------------------------------------------- //
// ---  INIT  ---
// ------------------------------------------------------------- //
SUB Init:
GOSUB ResetBall
// Draw playfield, use as background bitmap
BLACKSCREEN
DRAWRECT 0,0,640,16, RGB(255, 255, 255)
DRAWRECT 0,464,640,480, RGB(255,255,255)
DRAWRECT 312,0,16,480,RGB(255,255,255)
USEASBMP

//reset bat y location
bat_y[0]=240; bat_y[1]=240
//reset bat x location
bat_x[0]=16; bat_x[1]=600


ENDSUB // INIT




// ------------------------------------------------------------- //
// ---  RESETBALL  ---
// ------------------------------------------------------------- //
SUB ResetBall:
LOCAL ball_sx,ball_sy
ball_x=320
ball_y=240

IF ball_sx<0
        ball_sx=1
ELSE
        ball_sx=-1
ENDIF

ball_sy=1              


ENDSUB // RESETBALL




// ------------------------------------------------------------- //
// ---  SHOWALL  ---
// ------------------------------------------------------------- //
SUB ShowAll:
//show the bats
FOR num=0 TO 1
        DRAWRECT bat_x[num],bat_y[num],16,64,RGB(255,255,255)
        PRINT score[num],num*320 + 32,16
NEXT
//draw the ball
DRAWRECT ball_x,ball_y,16,16,RGB(255,255,255)
SHOWSCREEN
       


ENDSUB // SHOWALL




// ------------------------------------------------------------- //
// ---  MOVEALL  ---
// ------------------------------------------------------------- //
SUB MoveAll:
//paddles
        FOR num=0 TO 1
        //keys: A, Z
        IF KEY(30) THEN bat_y[0]=bat_y[0]-2
        IF KEY(44) THEN bat_y[0]=bat_y[0]+2
        //keys /\,\/
        IF KEY (200) THEN bat_y[1]=bat_y[1]-2
        IF KEY (208) THEN bat_y[1]=bat_y[1]+2
       
        // bat at upper/lower border?
        IF bat_y[num]<0 THEN bat_y[num]=0
        IF bat_y[num]>416 THEN bat_y[num]=416
NEXT
//ball
ball_x=ball_x+ball_sx
ball_y=ball_y+ball_sy  
//ball at bottom
IF ball_y>464
        ball_y=464
        ball_sy= -ball_sy
ENDIF
//ball at ceiling
IF ball_y<0
        ball_y=0
        ball_sy= -ball_sy
ENDIF
//ball left border score player 1
IF ball_x<0
        score[1]=score[1]+1
        GOSUB ResetBall
ENDIF
//ball right border score player 0
IF ball_x>624
        score[0]=score[0]+1
        GOSUB ResetBall
ENDIF  
FOR num=0 TO 1
IF (ball_sx<0 AND num=0) OR (ball_sx>0 AND num=1)
col=BOXCOLL (bat_x[num],bat_y[num],16,64,ball_x,ball_y,16,16)
IF col=TRUE
//turn ball speed in x direction
ball_sx=-ball_sx
//speed up ball
ball_sx=ball_sx*1.2
ball_sy=ball_sy*1.05
ENDIF
ENDIF
NEXT                   


ENDSUB // MOVEALL
 

13
That is awesome. How does it look with character sprites on it? That would make for a great shining force game.

14
Off Topic / Re: GCW Zero - New Console
« on: 2012-Jun-02 »
Ya, I did not notice that typo till later. oops.

15
Off Topic / Re: GCW Zero - New Console
« on: 2012-Jun-02 »
@cruelcynic, It can be more then a hobbyist tool, some skilled coders here make a living with it. As for learning it, it depends if you actually want to, but first time users have always managed to impress on what they can pull out after a few hours on it. :good:
I put some time in today and got the onemore tutorial game built. I wish the tutorial included defining the variables, but I figured it out and the game worked like a charm. Hell of a neat program.  :good:

Pages: [1] 2