Jump to content


prahasith

Member Since 16 Jun 2010
Offline Last Active Jul 28 2011 02:50 AM

Topics I've Started

Move_contact

20 February 2011 - 05:10 AM

Currently I am using move_contact_all for collision of my bullet. I want to make it be able to pass through some objects (they are not solid and I want to do it without using contact_solid). Is there a move_contact for a specific object? So that way I can use Parenting to specify what I want it to move_contact to?

Basically what I am asking is
Is there a move_contact for a specific object? Or an alternative way to do this?

Zombie AI Help

18 February 2011 - 04:42 AM

So I'm working on an game which is basically like nazi zombies in Call of Duty. Right now I am working on the AI and for some reason when you walk in certain places (such as top right) the AI can find a path to you when there is a path. I have no idea what the problem is. Any help would be helpful.

BLUE BLOCKS: WALLS
YELLOW BLOCKS: BARRICADES (stop zombies for a little before letting them through)
GREEN CIRCLE: PLAYER
RED CIRCLE: ZOMBIE

Up Arrow: Forward
Left and Right Arrows: Turn
Down Arrow: Backwards

PS: you might want to increase turn speed

DOWNLOAD MY FILE HERE
OR HERE
http://www.mediafire.com/?4od6symtj6wygsl

GML help

24 November 2010 - 08:01 PM

So im working on a spaceship game and plan on having a player object who's parents are going to be differnt spaceships well anyways this is what I don't know how to do.

1) Set the parent of an object in GML
2) Change the sprite and collision map of the object to the sprite and collision map of its parent

Efficency

30 September 2010 - 12:45 PM

Hey guys, I have written a pretty decent AI which patrols, finds the players, follows the player and shoots at the player. But currently running the AI causes me to drop 10-20 fps. Is there a methods I should follow to make it better? Can someone make it efficient for me? Is there certain things I should use instead of something else?

"I use motion planning to move about"
I am posting some of my code that I think is slowing me down


(My MP code)



tempvar=mp_grid_path(global.aig,mypath,x,y,wantx,wanty,true)
if(tempvar=false)
{
p_num=0
wantx=p[0,0]
wanty=p[0,1]
mp_grid_path(global.aig,mypath,x,y,wantx,wanty,true)
} 
path_set_kind(mypath,1); //Sets the path to allow diagonals...
path_set_precision(mypath,8); //Sets the path to curve...
path_start(mypath,3,0,false); //Starts the new path...


(Turning around code)
agility=12
if (angle_top < direction)
    {
    if (angle_top > direction-180) // this is the "normal" case
    {
        if (angle_top+agility < direction) {angle_top += agility;}
        else {angle_top = direction;}
    }
    else // this is when there is a jump between 0 and 360
    {
        if (angle_top+360-agility > direction) {angle_top -= agility;}
        else {direction = direction;}
    }
}
else
{
    if (angle_top < direction+180) // this is the "normal" case
    {
        if (angle_top-agility > direction) {angle_top -= agility;}
        else {angle_top = direction;}
    }
    else // this is when there is a jump between 0 and 360
    {
        if (angle_top-360+agility < direction) {angle_top += agility;}
        else {angle_top = direction;}
    }
}
while (angle_top>360) angle_top -= 360;
while (angle_top<0) angle_top += 360;



Line of sight code
I use this ALOT so this needs to be as efficient as possible

vrange=200
vangle=50
l=1
targetdir=point_direction(x,y,player.x,player.y)

tangle=angle_top
while(tangle>360)
tangle-=360

if(distance_to_object(player) > vrange)
l=0
if(collision_line(x,y,player.x,player.y,smoke_generator,false,true))   
l=0
if(collision_line(x,y,player.x,player.y,solid,false,true))    
l=0
if(abs(tangle-targetdir)>vangle && abs(tangle-targetdir)<360-vangle) 
l=0 

if(l=1)
{
global.lastx=player.x
global.lasty=player.y
return 1;
break;
}

if(object_index=camera)
{
return 0;
break;
}


ll=1
if(l=0)
{
    if(distance_to_object(player) > 100)
    ll=0
    if(collision_line(x,y,player.x,player.y,smoke_generator,false,true))   
    ll=0
    if(collision_line(x,y,player.x,player.y,solid,false,true))    
    ll=0
    

    if(ll=1)
    {
        global.lastx=player.x
        global.lasty=player.y
        return 1;
        break;
    }
}


return 0

InstanceOf

30 September 2010 - 03:15 AM

I want to use gml to find out if the object using the script is an instance of a certain object.

For example. I have a line of sight code and I want for cameras to behave differently than others objects. I know i can just make a second script but I would like to keep it contained in one.

PS: in java I would call instanceOf(Camera)