GameMakerHelpBlog

Friday, April 6, 2007

3D- Collisions FPS

In Fps games you will need collisions, this is a way i found out how to do collisions

1. Make Wall solid
2. Give the Wall a mask
3. Give the wall a parent
4. Give parent the mask
5. In player collsion with parent event put
x=xprevious
y=yprevious
6. Give player a mask

Labels:

3D - Low Realism Trees

Here is a script for simple looking trees (warning script is only provided for trees)

[code]obj=tree event=draw
d3d_draw_ellipsoid(x,y,20,x+32,y+32,30,background0,1,1,16)//draws greenery
d3d_draw_cylinder(x+8,y+8,0,x+24,y+24,20,background5,1,1,true,12)
d3d_draw_ellipsoid(x,y,30,x+32,y+32,40,background0,1,1,16)//draws greenery
d3d_draw_ellipsoid(x,y,30,x+24,y+16,35,background0,1,1,16)//draws greenery
d3d_draw_ellipsoid(x,y,30,x+16,y+24,35,background0,1,1,16)//draws greenery

Lol i can't be bothered doing color coding

Labels:

Turrets with tanks

Ever had trouble with tank games because they won't let there barrels spin??? well here is a code to make it work.

[code]obj=controller event=create
global.ta=ds_list_create()//Creates a list which will hold all the ID's
//of every tank so the turrets can identify which is theirs.
[/code]

[code]obj=tank's base event=create
ds_list_add(global.ta,id)//This adds the tanks unique ID to the list
position=ds_list_find_index(global.ta,id)//This gets the tank's position in
//that list.
turret=instance_create(x,y,Turret)//This code creates the turret and and gives
//us IT'S unique ID.
turret.owner=ds_list_find_value(global.ta,position)//This tells the unique
//turret that was just made
//exactly which tank
//created it.

[/code]

[code]obj=Tank event=step
image_angle=direction
[/code]

[code]obj=Turret event=step
x=owner.x //This tells the turret to be exactly where it's tank is.
y=owner.y
image_angle=direction//for appearance.
direction=point_direction(x,y,mouse_x,mouse_y)//again, for appearance.
[/code]

Labels: