BASIC

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Competitions / Re: Hello World - Contest
« Last post by WPShadow on 2019-Apr-09 »
Thank you!
 :good:
12
Competitions / Re: GLBasic Contest 02: 2D Art
« Last post by WPShadow on 2019-Apr-09 »
I know, this contest looks pointless at first, but it's pretty handy for backgrounds or scenes in games
13
Competitions / Re: Hello World - Contest
« Last post by Hemlos on 2019-Apr-09 »
 :good:
The string object lib i used, is up-to-date and ready to rock and roll.
Feel free to use it if you find handy, enjoy.
14
Competitions / GLBasic Contest 02: 2D Art
« Last post by WPShadow on 2019-Apr-08 »
Hi,

here we go, it's time for an other contest:


Definition

Write a 2D art program in GLBasic. It should be a little piece of art, not an art creation program.

Rules

  • Write the whole program only in GLBasic
  • no third party libraries
  • Keep the code short and simple
  • Make the result look impressive

Goal

Show us your best little art project, with or without movement and impress us.

Submission

Just post your code here in a codeblock, so everybody can study your awesome work.

Closing Date

19.05.2019

Example

Here is my little example. It's an optical illusion.

If you press the space bar, you can start and stop the movement.

Code: GLBasic [Select]

TYPE tRect
        x
        y
        direction
        speed
ENDTYPE

GLOBAL rect[] AS tRect, space

main()

FUNCTION main:

        generateRects()

        WHILE TRUE
               
                drawLines()
                drawBoxes()
               
                IF INKEY$() = " "
                        INC space, 1
                        IF space > 1 THEN space = 0
                ENDIF
       
                SHOWSCREEN
        WEND

ENDFUNCTION

FUNCTION generateRects:
LOCAL r AS tRect
LOCAL offset
       
       
        FOR tmpY = 0 TO 15
       
                offset = RND(25)
               
                r.direction =  MOD(tmpY, 2)
                r.speed = 100 + RND(200)
               
                FOR tmpX = 0 TO 10
                        r.x = 0 + (tmpX * 60) + offset
                        r.y = 5 + (tmpY * 30)
                       
                        DIMPUSH rect[], r
                       
                NEXT
        NEXT

ENDFUNCTION

FUNCTION addRect: x, y, direction

ENDFUNCTION

FUNCTION drawLines:
LOCAL tmpY

        FOR tmpY = 0 TO 15
                DRAWRECT 0, 0 + (tmpY * 30), 640, 5, RGB(128, 128, 128)
        NEXT

ENDFUNCTION

FUNCTION drawBoxes:

        FOREACH r IN rect[]

                IF space = TRUE
                        IF r.direction = 0
                                INC r.x, r.speed / 500
                        ENDIF
                        IF r.direction = 1
                                DEC r.x, r.speed / 500
                        ENDIF
                ENDIF

                DRAWRECT r.x, r.y, 5, 25, RGB(128, 128, 128)
                DRAWRECT r.x + 5, r.y, 25, 25, RGB(255, 255, 255)
                DRAWRECT r.x + 30, r.y, 5, 25, RGB(128, 128, 128)
               
                IF r.x < -30
                        r.x = 640
                ENDIF
                IF r.x > 640
                        r.x = -30
                ENDIF
        NEXT

ENDFUNCTION
 

Winner

This is a fun contest and there is nothing to win... Nevertheless, together we can choose a winner...



Good luck and have fun.
15
Competitions / Re: Hello World - Contest
« Last post by WPShadow on 2019-Apr-08 »
I'm only the "promoter" of the contest, so my code will only be some kind of example...

I've a great idea for the next contest and will set it up this week, if somebody would like to join it  =D
16
GLBasic - en / Re: Smooth scroll
« Last post by Snoopy on 2019-Apr-07 »
I made a smoother version that also retains the resolution.
I added a fish for fun too... a future game "Flappy Fish"??  :D

Normally, there should be no problem except in case of slowing down the computer.
17
Competitions / Re: Hello World - Contest
« Last post by dreamerman on 2019-Apr-06 »
ah.. can't decide, all entries have something interesting.. btw. WPShadow You forgot to include yourself in poll :D
18
GLBasic - en / Re: Smooth scroll
« Last post by erico on 2019-Apr-06 »
Like Snoopy said.

Tried his code and I found it works better than mine on that front but still stutters a little bit.
Later I found out it was something on my new computer´s gfx config that was causing the harder stutters.
Also, I´d like to keep the resolution on par with the gfx, no higher res that can do "subpixel" movement.

I´m still working a middle ground to all these but the gfx board config was really what was dragging things down.
It now stutters very very seldomly. :)
19
Announcements / Re: Humble Bundle 2d graphics 8 bits.
« Last post by Snoopy on 2019-Apr-06 »
Again a nice find mentalthink!
You are a true treasure hunter, you often find a lot of interesting things  :)
20
GLBasic - en / Re: Smooth scroll
« Last post by Snoopy on 2019-Apr-06 »
No Dreamerman, even if you use a floating calculus and after an integer for the drawing, you will still have a tremor problem, especially in this type of scrolling.
Pages: 1 [2] 3 4 ... 10