Tuesday, March 3, 2009

I Don't buy games, i make them

Well actually i do buy games but as some people in our class might already know, i make them as well. The quality isn't very good but it isn't a piece of cake, or pie. to prove this i have dispalyed the ai (artificial intelligence) script. I was going to include a vid but i need to compress the size, so i will edit this post tomoro and the vid will be there ;)


ar nearest_enemy, nearest_cover, nearest_bullet, safe_x, safe_y, sped, dir, bb;

if instance_exists(argument0) && instance_exists(argument1) {

nearest_enemy=instance_nearest(x,y,argument0)
nearest_cover=instance_nearest(x,y,argument1)
nearest_bullet=instance_nearest(x,y,argument2)
dir=point_direction(x,y,nearest_cover.x,nearest_cover.y)
safe_x=nearest_cover.x+lengthdir_x(distance_to_object(nearest_cover)+64,dir)
safe_y=nearest_cover.y+lengthdir_y(distance_to_object(nearest_cover)+64,dir)
sped=(argument4+argument5/(1+(1+distance_to_object(nearest_enemy)/70)))+(distance_to_point(safe_x,safe_y)/70)
can_shoot-=1
if speed>argument5 speed=argument5
if collision_line(x,y,nearest_enemy.x,nearest_enemy.y,argument1,1,1)
mode=1

if !collision_line(x,y,nearest_enemy.x,nearest_enemy.y,argument1,1,1) && distance_to_object(nearest_cover)>10
mode=0

if mode=1{
if argument7=1
point_direction(x,y,nearest_enemy.x,nearest_enemy.y)
if collision_line(x,y,nearest_enemy.x,nearest_enemy.y,argument1,1,1){
if point_distance(nearest_enemy.x,nearest_enemy.y,shootx,shooty)>90
or (x!=sx && y!=sy)
mp_potential_step(nearest_enemy.x,nearest_enemy.y,argument4,0)
if distance_to_object(nearest_cover)>10
mp_potential_step(nearest_cover.x,nearest_cover.y,(argument4/2),0)}
else{
shootx=nearest_enemy.x
shooty=nearest_enemy.y
sx=x
sy=y
speed=0

}

if distance_to_object(nearest_bullet) <>
if !collision_line(x,y,nearest_bullet.x,nearest_bullet.y,argument1,1,1)
mp_potential_step(nearest_bullet.x+45,nearest_bullet.y+45,-8,0)}
if can_shoot<1
{if x=sx && y=sy{
bb=instance_create(x,y,argument3)
bb.direction=point_direction(x,y,(shootx-((speed+4)*10)+random((((speed+4*2))*10))),shooty)}
if !collision_line(x,y,nearest_enemy.x,nearest_enemy.y,argument1,1,1)
can_shoot=argument6
else
can_shoot=(argument6*3)}}

if mode=0{
if !collision_line(x,y,nearest_enemy.x,nearest_enemy.y,argument1,1,1)
mp_potential_step(safe_x,safe_y,sped,0)
else
speed=0
if distance_to_object(nearest_enemy)<100{
if can_shoot<1
{if !collision_line(x,y,nearest_enemy.x,nearest_enemy.y,argument1,1,1){{
bb=instance_create(x,y,argument3)
bb.direction=point_direction(x,y,(nearest_enemy.x-(speed*20)+random((speed*40))),nearest_enemy.y)}
if argument7=1
point_direction(x,y,nearest_enemy.x,nearest_enemy.y)}
can_shoot=argument6}
}
else{if argument7=1
point_direction(x,y,safe_x,safe_y)
}}
}


the language is fairly easy but its complicated to put it all together with working objects in some srtrange way. it sounds a bit geeky but its fun until i get bored, then i lay off for a month, then i resume creating games.

Quote of today: Teehee -The sherrrrrifff

1 comment: