|
Post by Darkjester on Sept 13, 2008 17:17:32 GMT -5
I have a challenge for all you basic4glers! ;D I dare you to write the most complicated program that you can posibly write you can have up to 4 VAriables max! Have fun and please post them on this thread. The rules are as followed 1. We have to see your code to prove you followed the rule 2. Each program can only have up to 6 variables max! 3. There is no limit on the amount of commands used in each program 4. This is meant to be fun for those who cant thank of a project to do at the moment(odama666 ) So have fun ;D 5.YOU CANNOT USE ARRAYS
|
|
|
Post by Nicky Peter Hollyoake on Sept 13, 2008 17:24:21 GMT -5
Dim _String(100000) AS STRING Dim _Integer(100000) AS INTEGER Dim _Float(100000) AS DOUBLE Probaly be hard to keep upto date what array does what, but its only 3, I think you need to rethink your options alowwed.
|
|
|
Post by Adam on Sept 13, 2008 17:27:44 GMT -5
Um darkjester, maybe you should have 4 variables max and no arrays
|
|
|
Post by James :) (aka Madcow) on Sept 13, 2008 17:32:54 GMT -5
dim a#,b#,c#,d# while true print a# a# = sin(34)*b#/a#+1 - c# * d# + rnd() c# = b# - d# / a# cls wend
|
|
|
Post by Darkjester on Sept 13, 2008 17:34:11 GMT -5
Changed to max of six vars
|
|
|
Post by James :) (aka Madcow) on Sept 13, 2008 17:48:14 GMT -5
look i got nan
dim a#,b#,c#,d# while true print a# a# = sin(34)*b#/a#+1 - c# * d# + rnd() c# = b# - d# / a# b# = b# + 1 d# = c# * d# * a# print "."+c# print "basic startrex consloe" if rnd()%10 > 5 then color(rnd()%255,rnd(),rnd()) locate 17,16 print "arnig!" locate 16,16 print "bug "+b# color(255,0,0) locate d#, b# print "Error" locate 10,10 print "restart system" else locate 16,16 print "bug "+d# color(255,rnd(),0) locate d#, b# print "ww0j3" endif locate 0,0 cls wend
|
|
|
Post by Darkjester on Sept 13, 2008 17:51:54 GMT -5
Nice whats it supposed to do?
|
|
|
Post by Adam on Sept 13, 2008 17:53:38 GMT -5
When I first saw the 4 vars only, i freaked. then i realized that you dont need variables for everything.
Gravity Balls With 3 Variables ;D
Const MBalls = 100
Dim MousePos#(1) Dim I
TextMode(Text_Buffered) For I= 0 to Mballs-1 NewSprite(LoadTexture("Data/Ball.png")) SprSetPos(Rnd()% 640, Rnd()% 480) SprSetSize(10,10) Next
Do While SyncTimer(15) MousePos# = Vec2(Mouse_X()*SpriteAreawidth(),Mouse_Y()*SpriteAreaHeight()) For I = 0 To Mballs-1 BindSprite(I+1) IF SprX() > MousePos#(0) OR SprX() > SpriteAreaWidth() Then SprSetXVel(SprXVel()-0.1) ElseIF SprX() < MousePos#(0) Then SprsetXVel(SprXVel()+0.1) Endif IF sprY() > MousePos#(1) Then SprsetYVel(SprYVel()-0.1) ElseIF sprY() < MousePos#(1) Then SprsetYVel(SprYVel()+0.1) Endif IF SprXVel() < 0 Then SprSetXVel(SprXVel()+0.01) ElseIf SprXVel() > 0 Then SprSetXVel(SprXVel()-0.01) Endif IF SprYVel() < 0 Then SprSetYVel(SprYVel()+0.01) ElseIf SprYVel() > 0 Then SprSetYVel(SprYVel()-0.01) Endif Next AnimateSprites() DrawText() Wend Loop
|
|
|
Post by Darkjester on Sept 13, 2008 17:54:23 GMT -5
Runs really smooth (
|
|
|
Post by Darkjester on Sept 13, 2008 18:46:22 GMT -5
Heres my first challenge code DECLARE SUB MOUSERETURN()
DIM MOUSE_X#, MOUSE_Y#
DO GLCLEAR(GL_DEPTH_BUFFER_BIT OR GL_COLOR_BUFFER_BIT) GLLOADIDENTITY() GLPUSHMATRIX() GLTRANSLATEF(-1, 0, -6) MOUSERETURN() GLBEGIN(GL_TRIANGLES) GLCOLOR3F(1, 0, 0) GLVERTEX3F(MOUSE_X#, MOUSE_X(), MOUSE_X#) GLCOLOR3F(0, 1, 0) GLVERTEX3F(MOUSE_Y#, 1, MOUSE_X#) GLCOLOR3F(0, 0, 1) GLVERTEX3F(-MOUSE_X#, 0, MOUSE_Y#) GLEND() SWAPBUFFERS() GLPOPMATRIX() LOOP
SUB MOUSERETURN() MOUSE_X# = MOUSE_X() MOUSE_Y# = MOUSE_Y() ENDSUB
|
|
|
Post by Darkjester on Sept 13, 2008 18:48:30 GMT -5
Another one! dim i gltranslatef(-1.5,-0.5,-6)
glscalef(1.5,1.5,1.5) glbegin(gl_lines) for i = 0 to 360 glcolor3f(1,0,0) GLVertex2F(1-cosd(i+1), 1+sind(i+1)) glcolor3f(0,0,1) GLVertex2F(1+sind(i+1), 1+sind(i+1)) glcolor3f(0,1,1) GLVertex2F(1+cosd(i+1), 1-cosd(i+1)) next glend() swapbuffers() dim i gltranslatef(-1.5,-0.5,-6)
glscalef(1.5,1.5,1.5) glbegin(gl_lines) for i = 0 to 360 glcolor3f(1,0,0) GLVertex2F(1-cosd(i+100), 1+sind(i+10)) glcolor3f(0,0,1) GLVertex2F(1+sind(i+100), 1+sind(i+10)) glcolor3f(0,1,1) GLVertex2F(1+cosd(i+10), 1-cosd(i+10)) next glend() swapbuffers() Sry for the double post
|
|
|
Post by Nicky Peter Hollyoake on Sept 13, 2008 19:27:45 GMT -5
TextMode(TEXT_BUFFERED)
Dim Player = NewSprite(100) SprSetColor(1, 0, 0) SprSetSize(SprXSize()*2, SprYSize()/2.0) SprSetPos((SpriteAreaWidth()-SprXSize()) / 2.0, 0) SprSetXCentre(0) SprSetYCentre(0)
Dim Enemy = NewSprite(100) SprSetColor(0, 1, 0) SprSetSize(SprXSize()*2, SprYSize()/2.0) SprSetPos((SpriteAreaWidth()-SprXSize()) / 2.0, SpriteAreaHeight()-SprYSize()) SprSetXCentre(0) SprSetYCentre(0)
Dim Ball = NewSprite(LoadTex("Data/Ball.PNG")) SprSetPos((SpriteAreaWidth()-SprXSize()) / 2.0, (SpriteAreaHeight()-SprYSize()) / 2.0) SprSetXCentre(0) SprSetYCentre(0) SprSetVel(0.1, 0.1)
While TRUE
'Ball BindSprite(Ball) SprSetPos(SprPos()+SprVel())
if SprX() < 0 OR SprX() > SpriteAreaWidth()-SprXSize() Then SprSetXVel(-SprXVel())
Elseif SprY() < 0 OR SprY() > SpriteAreaHeight()-SprYSize() Then SprSetYVel(-SprYVel()) Endif
'Player BindSprite(Player)
if ScanKeyDown (VK_RIGHT) AND SprX() < SpriteAreaWidth()-SprXSize() Then SprSetX(SprX()+1)
Elseif ScanKeyDown (VK_LEFT) AND SprX() > 0 Then SprSetX(SprX()-1) Endif
'Enemy BindSprite(Enemy)
'A.I if SprX() > SprX(Ball) Then SprSetX(SprX()-1)
Elseif SprX() < SprX(Ball) Then SprSetX(SprX()+1) Endif
'Collision 'Ball and player if SprX(Player)+SprXSize(Player) > SprX(Ball) AND SprX(Player) < SprX(Ball)+SprXSize(Ball) Then if SprY(Player)+SprYSize(Player) > SprY(Ball) AND SprY(Player) < SprY(Ball)+SprYSize(Ball) Then
BindSprite(Ball) SprSetVel(SprVel()+Vec2(0.01, 0.01)) SprSetVel(-SprVel())
Endif Endif
'Ball and enemy if SprX(Enemy)+SprXSize(Enemy) > SprX(Ball) AND SprX(Enemy) < SprX(Ball)+SprXSize(Ball) Then if SprY(Enemy)+SprYSize(Enemy) > SprY(Ball) AND SprY(Enemy) < SprY(Ball)+SprYSize(Ball) Then
BindSprite(Ball) SprSetVel(SprVel()+Vec2(0.01, 0.01)) SprSetVel(-SprVel())
Endif Endif
DrawText() Wend
Just a ping pong, no lives, no dieing when off edge, basicailly couldn't be arse.
I was thinking making the collision more accurate while the image size is bigger then the image you can see but once again couldn't be arse to keep testing see if I'm right/wrong.
- Nicky
|
|
|
Post by Darkjester on Sept 13, 2008 19:33:33 GMT -5
Nice but the program seems to have only one path...
did you take a look at part one of my tut?
|
|
|
Post by Nicky Peter Hollyoake on Sept 13, 2008 19:37:56 GMT -5
Couldn't be arse, justw anted to make something to do your test, and wheres the tutorial? Posted it up somewhere?
|
|
|
Post by Darkjester on Sept 13, 2008 19:39:34 GMT -5
I though i sent it PM? ill send it again im posting it when finished as a zip chtml file
Edit: Heres another Challenge demo
Dim A# = 0.7, B# = 0.3, C#, D#
A# = Pow(A#,2) : B# = Pow(B#,2) : C#=A#+B# : D# = Sqrt(C#)
Textmode(Text_Overlaid) Gltranslatef(-1.5,-0.5,-6)
GlBegin(gl_Triangles) GlColor3F(1,0,0) GlVertex2f(A#,0) GlColor3F(0,1,0) GlVertex2f(0,B#) GlColor3F(0,0,1) GlVertex2f(D#,1) GlEnd() Swapbuffers() Locate 1,1 : Print "Pythagorean Theorem" Locate 5,5 : Print "A = " + A# Locate 5,6 : Print "B = " + B# Locate 5,7 : Print "C = " + D# Drawtext()
|
|