While the tutorial did work for a while, I ran into some problems in the "create an enemy" part of the tutorial.
You see, the enemy's are invisible. while this ups the tension a good bit, but it doesn't quite work.
The first thing you see will be a basic menu. just click the first button to go to the room wich actually works. You'll see an incredibly ugly room with a minigun in it. after a little while you'll here the ow sound, wich means that the monsters work. they also die like they should, but they just stay invisible.
I already asked a person who's quite experienced with gamemaker, but he can't find the problem.
I'll just post the gamemaker information here, since that's the quickest.
I used the standard files, sounds, scripts and sound from the tutorial but it just refuses to work.
If there're any questions, please ask.
player object:
Information about object: obj
Sprite: Sprite_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>
Create Event:
execute code:
zdir = 0
display_mouse_set(display_get_width()/2,display_get_height()/2)
globalvar camx,camy,camcos,camsin;
direction = 0;
friction = 0.2;
pitch = 0;
playerheight = 12
playerspeed = 2
camx = x; camsin = sin(direction*pi/180);
camy = y; camcos = cos(direction*pi/180);
d3d_start();
d3d_set_hidden(false);
d3d_set_lighting(false);
d3d_set_culling(false);
d3d_set_fog(true,c_black,10,300);
texture_set_interpolation(true);
Step Event:
execute code:
if keyboard_check(ord('W')){x += playerspeed*camcos;y -= playerspeed*camsin;}
if keyboard_check(ord('S')){x -= playerspeed*camcos;y += playerspeed*camsin;}
if keyboard_check(ord('A')){x += playerspeed*(cos((direction+90)*pi/180));y -= playerspeed*(sin((direction+90)*pi/180));}
if keyboard_check(ord('D')){x += playerspeed*(cos((direction-90)*pi/180));y -= playerspeed*(sin((direction-90)*pi/180));}
if keyboard_check(vk_shift) then {playerheight = 4} else {playerheight = 12}
End Step Event:
execute code:
{
camx = x;
camy = y;
camsin = sin(direction*pi/180);
camcos = cos(direction*pi/180);
playerspeed = playerheight/6
direction -= (display_mouse_get_x()-(display_get_width()/2))/4;
pitch -= (display_mouse_get_y()-(display_get_height()/2))/4;
display_mouse_set(display_get_width()/2,display_get_height()/2);
if pitch > 89 then pitch = 89;
if pitch < -89 then pitch = -89;
}
Collision Event with object object_wall_basic_hor:
execute code:
if keyboard_check(ord('W')){y += playerspeed*camsin;}
if keyboard_check(ord('S')){y -= playerspeed*camsin;}
if keyboard_check(ord('A')){y += playerspeed*(sin((direction+90)*pi/180));}
if keyboard_check(ord('D')){y += playerspeed*(sin((direction-90)*pi/180));}
Collision Event with object object_wall_basic_ver:
execute code:
if keyboard_check(ord('W')){x -= playerspeed*camcos;}
if keyboard_check(ord('S')){x += playerspeed*camcos;}
if keyboard_check(ord('A')){x -= playerspeed*(cos((direction+90)*pi/180));}
if keyboard_check(ord('D')){x -= playerspeed*(cos((direction-90)*pi/180));}
Draw Event:
execute code:
// set the projection
d3d_set_projection(x,y,playerheight, x+camcos,y-camsin,playerheight+tan(degtorad(pitch)),0,0,1);
draw_set_alpha(1);
draw_set_color(c_white);
d3d_draw_floor(0,0,0,640,480,0, background_get_texture(texture_floor),24,18);
d3d_draw_floor(0,0,48,640,480,48, background_get_texture(texture_floor),16,12);
the enemy himself:
Information about object: obj_monster1
Sprite: spr_monster
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent: obj_monster_basic
Mask: <same as sprite>
Create Event:
set variable image_speed to 0.3
set variable image_index to floor(random(4))
Destroy Event:
execute code:
{
instance_create(x,y,obj_monster1_dead);
}
Begin Step Event:
execute code:
{
if (point_distance(x,y,global.camx,global.camy) > 200)
{ speed = 0; exit; }
if (collision_line(x,y,global.camx,global.camy,obj_parent_wall,false,false))
{ speed = 0; exit; }
if (point_distance(x,y,global.camx,global.camy) < 12)
{
speed = 0; health -= 2;
if not sound_isplaying(snd_ow) sound_play(snd_ow);
exit;
}
move_towards_point(global.camx,global.camy,1.4);
}
Draw Event:
execute code:
{
var tex;
tex = sprite_get_texture(tex_monster,image_index);
d3d_draw_wall(x-8*global.camsin,y-8*global.camcos,19,
x+8*global.camsin,y+8*global.camcos,3,tex,1,1);
}
I don't really know wich files you need to see, so please say it if this is insufficient.
Edited by mastermarty, 12 February 2012 - 10:42 AM.











