I'm a slow programmer

Posted by s on Jan. 30, 2008, 11:31 a.m.

I tried that 2hour thing. Took me fourty minutes to have a circle moving around that could fire a shot or a bomb and my enemy system failed. I suppose I was silly to think it'd be easier to make it all in the room create code

Anyways, the plan to kill Firefly is quite easy. Just sneak up behind him with one of these

Too bad I ate forgot the batteries

64D could really use a syntax highlighting tag to implement on languages, more directly, GML

Sorry if code is ugly, was in a hurry

[pre]window_set_visible(1)

ux=160;uy=120;global.bid=0;global.sid=0;ud=0;bx=0;by=0;bd=0;gx=0;gy=0;gs=0;gd=0

while(1){

io_handle()

draw_set_color(draw_set_alpha(.01))

draw_rectangle(0,0,320,240,0)

ud+=ptdir(ud,point_direction(ux,uy,mouse_x,mouse_y),8)

if mouse_check_button(mb_left){bx=ux;by=uy;bd=point_direction(ux,uy,mouse_x,mouse_y)}

if mouse_check_button(mb_right)&&gs=0{gx=ux;gy=uy;gd=point_direction(ux,uy,mouse_x,mouse_y);gs=16}

if keyboard_check(ord("W")){ux+=lengthdir_x(4,ud);uy+=lengthdir_y(4,ud)}

if keyboard_check(ord("S")){ux+=lengthdir_x(1,-ud);uy+=lengthdir_y(1,-ud)}

if keyboard_check(ord("A")){ux+=lengthdir_x(2,ud+90);uy+=lengthdir_y(2,ud+90)}

if keyboard_check(ord("D")){ux+=lengthdir_x(2,ud-90);uy+=lengthdir_y(2,ud-90)}

draw_set_color(-1)

repeat(16){

bx+=lengthdir_x(1,bd)

by+=lengthdir_y(1,bd)

draw_point(bx,by)

v=0;repeat(global.bid){v+=1;global.bid[v,2]*=round(global.bid[v,0])!=round(bx)&&round(global.bid[v,1])!=round(by)}

}

repeat(gs){gs-=1

if gs{

gx+=lengthdir_x(1,gd)

gy+=lengthdir_y(1,gd)

}else{

draw_circle(gx,gy,16,0)

v=0;repeat(global.bid){v+=1;global.bid[v,2]*=point_distance(global.bid[v,0],global.bid[v,1],gx,gy)>16}

}}

draw_circle(ux,uy,2,0)

draw_line(ux,uy,ux+lengthdir_x(4,point_direction(ux,uy,mouse_x,mouse_y)),uy+lengthdir_y(4,point_direction(ux,uy,mouse_x,mouse_y)))

draw_circle(mouse_x,mouse_y,1,1)

draw_set_color(255)

if random(20)<<0{

global.bid+=1;global.bid[global.bid,0]=random(640);global.bid[global.bid,1]=floor(random(2))*480;global.bid[global.bid,2]=8

}

v=0;repeat(global.bid){v+=1

if!global.bid[v,2]{global.bid[v,0]=global.bid[global.bid,0];global.bid[v,1]=global.bid[global.bid,1];global.bid[v,2]=global.bid[global.bid,2];global.bid-=1}

if random(2)=1{global.sid+=1;global.sid[global.sid,0]=global.bid[global.bid,0];global.sid[global.sid,1]=global.bid[global.bid,1];global.sid[global.sid,2]=point_direction(x,y,ux,uy)}

global.bid[v,0]+=lengthdir_x(2,point_direction(x,y,ux,uy))

global.bid[v,1]+=lengthdir_y(2,point_direction(x,y,ux,uy))

draw_circle(global.bid[v,0],global.bid[v,1],global.bid[v,2]/4,0)

}

v=0;repeat(global.sid){v+=1

repeat(12){global.sid[v,0]+=lengthdir_x(1,global.sid[v,2]);global.sid[v,1]+=lengthdir_y(1,global.sid[v,2])

if round(global.sid[v,0])=ux&&round(global.sid[v,1])=uy{

game_restart();exit}}}

screen_refresh();sleep(1)

if keyboard_check(vk_escape){game_end();exit}}[/pre]

Comments

Jaxx 16 years, 11 months ago

Code Blog =O

yeah, I was about to try for that comp, but decided not to >_<

PY 16 years, 11 months ago

Firefly should be scared.

I'd give it a try, but it involves joining poppenkast, so no.

But serpy, really:

if keyboard_check(vk_escape){game_end();exit]

For one thing, a ] isn't a real character (Is the parser screwy again?), and another, isn't GM supposed to do that for you?

s 16 years, 11 months ago

GM doesn't exit code for game_end() and it is in a loop and 2}s become ] by the parser

PY 16 years, 11 months ago

Oh, fair enough.

Guess I'm not doing enough loops, then. <_<

Also, yeah, syntax highlighting? Here? On 64Digits?

I can see that go wrong, and colour all my words…

s 16 years, 11 months ago

I've been able to burden FF with the task of making SF have a GML highlighting. So, won't be long before we can crush him

PY 16 years, 11 months ago

Crush him like the bug he calls himself, mwahahaha!