Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Example / Listing] [gm6]My platform ai script (jumps over obstacles and gaps!)  (Read 1085 times)

0 Members and 1 Guest are viewing this topic.
[Example / Listing] [gm6]My platform ai script (...
« on: June 30, 2006, 12:36:03 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 122
This didn't take me too long, it works pretty well if you're experienced with gm6

argument0: The distance at which the enemy will attack
argument1: The speed
argument2: whether or not to jump over obstacles
argument3: whether or not to jump over gaps
argument4: The right sprite
argument5: The left sprite
argument6: The x to attack (the destination)
argument7: The y to attack (the destination)
in scr_ai script enter
Code: [Select]
dis=point_distance(x,y,argument6,argument7)
dir=point_direction(x,y,argument6,argument7)
if dir>270 or dir<=90
{
dir_2=0
}
else
{
dir_2=180
}
if dis<argument0
{
if dir_2=0
{
sprite_index=argument4
if place_free(x+argument1,y)
{
x+=argument1
if place_free(x+argument1,y+1) and argument3=true and gravity=0
{
vspeed=-3.5
}
}
else
{
if gravity=0 and argument2=true
{
vspeed=-3.5
}
}
}
if dir_2=180
{
sprite_index=argument5
if place_free(x-argument1,y)
{
x-=argument1
if place_free(x-argument1,y+1) and argument3=true and gravity=0
{
vspeed=-3.5
}
}
else
{
if gravity=0 and argument2=true
{
vspeed=-3.5
}
}
}
}

oh yeah, for gravity, I suggest you use...
Code: [Select]
if place_free(x,y+1)
{
gravity=.1
}
else
{
gravity=0
}
« Last Edit: March 18, 2012, 07:07:34 am by Niek »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.083 seconds with 36 queries.