3D - FPS full
I put about the Start of 3D b4 but lets put it to the test......
Create event
[code]
{
friction = 0.2;
// initialize 3D
d3d_start();
d3d_set_hidden(true);
d3d_set_lighting(false);
d3d_set_culling(false);
d3d_set_fog(true,c_white,10,300);
// interpolate textures
texture_set_interpolation(true);
}
[/code]
Create event too
[code]
{
global.camx = x;
global.camy = y;
global.camsin = sin(direction*pi/180);
global.camcos = cos(direction*pi/180);
}
[/code]
^this uses pi for this code.
End step event
[code]
{
global.camx = x;
global.camy = y;
global.camsin = sin(direction*pi/180);
global.camcos = cos(direction*pi/180);
}
[/code]
Left arrow key event
[code]
direction+=3
[/code]
Right arrow key event
[code]
direction-=3
[/code]
Up arrow key event
[code]
{
var maxspeed;
if keyboard_check(vk_shift) maxspeed = 3 else maxspeed = 1.5;
if (speed < speed =" min(maxspeed" maxspeed =" 3" maxspeed =" 1.5;"> -maxspeed) speed = max(-maxspeed,speed-0.4);
}
[/code]
draw event includes arguments
argument0 = floor background
argument1 = sky background
[code]
{
// set the projection
d3d_set_projection(x,y,10, x+cos(direction*pi/180),y-sin(direction*pi/180),10, 0,0,1);
// set color and transparency
draw_set_alpha(1);
draw_set_color(c_white);
// draw floor and ceiling
d3d_draw_floor(0,0,0,room_width,room_height,0,
background_get_texture(argument0),32,32);
d3d_draw_floor(0,0,32,room_width,room_height,32,
background_get_texture(argument1),24,24);
}
[/code]
This should make a basic FPS game if not please tell me
Create event
[code]
{
friction = 0.2;
// initialize 3D
d3d_start();
d3d_set_hidden(true);
d3d_set_lighting(false);
d3d_set_culling(false);
d3d_set_fog(true,c_white,10,300);
// interpolate textures
texture_set_interpolation(true);
}
[/code]
Create event too
[code]
{
global.camx = x;
global.camy = y;
global.camsin = sin(direction*pi/180);
global.camcos = cos(direction*pi/180);
}
[/code]
^this uses pi for this code.
End step event
[code]
{
global.camx = x;
global.camy = y;
global.camsin = sin(direction*pi/180);
global.camcos = cos(direction*pi/180);
}
[/code]
Left arrow key event
[code]
direction+=3
[/code]
Right arrow key event
[code]
direction-=3
[/code]
Up arrow key event
[code]
{
var maxspeed;
if keyboard_check(vk_shift) maxspeed = 3 else maxspeed = 1.5;
if (speed < speed =" min(maxspeed" maxspeed =" 3" maxspeed =" 1.5;"> -maxspeed) speed = max(-maxspeed,speed-0.4);
}
[/code]
draw event includes arguments
argument0 = floor background
argument1 = sky background
[code]
{
// set the projection
d3d_set_projection(x,y,10, x+cos(direction*pi/180),y-sin(direction*pi/180),10, 0,0,1);
// set color and transparency
draw_set_alpha(1);
draw_set_color(c_white);
// draw floor and ceiling
d3d_draw_floor(0,0,0,room_width,room_height,0,
background_get_texture(argument0),32,32);
d3d_draw_floor(0,0,32,room_width,room_height,32,
background_get_texture(argument1),24,24);
}
[/code]
This should make a basic FPS game if not please tell me
Labels: 3D - Advanced
