200byteDemoChallenge!

BlitzMax Forums/BlitzMax Programming/200byteDemoChallenge!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I thought I'd give this a try... Nothing special just a lil chase routine :)

use the arrows to move, ESC to quit

only got it to 365... :(

g=200;r=190;Graphics g,g;SetColor 150,100,250;s=5;x1=100;y1=160;While KeyHit(27)=0;Cls
If KeyDown(37) Then x:-s;If KeyDown(39) Then x:+s;If KeyDown(38) Then y:-s;If KeyDown(40) Then y:+s
If x<0 Then x=0;If x>g Then x=g;If y<0 Then y=0;If y>g Then y=r;DrawOval(x,y,10,10);If x<x1 Then x1:-2 Else x1:+2;If y<y1 Then y1:-2 Else y1:+2
DrawRect(x1,y1,10,15);Flip;Wend



-- EDIT --

I worked it a bit and got it down to 208! :)

g=99;Graphics g,g While KeyHit(27)=0;If KeyDown(37)x:-5
If KeyDown(39)x:+5
If KeyDown(38)y:-5
If KeyDown(40)y:+5
If x<a a:-2 Else a:+2
If y<b b:-2 Else b:+2
DrawOval x,y,7,7DrawRect a,b,9,9Flip;Cls;Wend


-- EDIT 2 --

Best *with* edge detection is 256

g=99;Graphics g,g While KeyHit(27)=0;If KeyDown(37)x:-5
If KeyDown(39)x:+5
If KeyDown(38)y:-5
If KeyDown(40)y:+5
If x<0 x=0
If x>g x=g
If y<0 y=0
If y>g y=g
If x<a a:-2 Else a:+2
If y<b b:-2 Else b:+2
DrawOval x,y,7,7DrawRect a,b,9,9Flip;Cls;Wend