Jump to content


hit172

Member Since 30 Oct 2007
Offline Last Active Apr 03 2012 12:41 AM

Posts I've Made

In Topic: 3d terrain generation trouble

03 April 2012 - 12:44 AM

I've been trying to generate terrain in 3d for awhile and i just can't seem to get it to work.
My most recent attempt uses the following code:

Create Event:

execute code:

global.ter = ds_grid_create(room_width,room_height)
ee = random_range(20,30)
{e = (ee*32)}
slope = choose(-8,0,8)

//initial generation
for(b = 0;b < room_height;b+= 512){
for(a = 0;a < room_width;a += 32){
ds_grid_set(global.ter,a,b,e)
e += slope
slope += choose(-8,0,8)}}

//filling in terrain
a = 0
b = 0
for(a = 0;a < room_width;a += 32)
n = ds_grid_get(global.ter,a,b)
m = ds_grid_get(global.ter,a,b+512)
s = (m/512)
val = n+s
for(set = 32;set < 480;set += 32){
ds_grid_set(global.ter,a,set,val)
val += s}
alarm[0] = 1

Alarm Event for alarm 0:

execute code:

for(j = 0;j < room_width;j += 32){
for(k = 0; k < 512;k += 32){
instance_create(j,k,obj_block)}}


Obj_block:
Create Event:

execute code:

z = ds_grid_get_disk_max(global.ter,x+16,y+16,16)
if (!z =0)
draw_set_alpha(1/z)

Can anybody tell me how to fix this or give me an example or something? Because nothing i try has been working.


I wish people these days knew what google was......
tutorial link

In Topic: Issue with P3DC

12 March 2012 - 03:09 PM

can you post an example of a model file (like a cube).
oh and make sure that the model is triangulated.

In Topic: Translate problem :/

07 March 2012 - 04:12 PM

d3d_transform_set_identity();

d3d_transform_add_scaling(0.1, 0.1, 0.1);

d3d_transform_add_rotation_y(90);



d3d_transform_add_translation(x, y, z); //where you want the model in relation to the player



d3d_transform_add_rotation_z(direction+90);

d3d_transform_add_translation(x, y, 0);

d3d_model_draw(model, 0, 0, 0, -1);



d3d_transform_set_identity();

In Topic: 3d sprites

05 March 2012 - 12:08 PM

Thanks for posting useless code. Read the topic next time.

In Topic: Swinging a First-Person Sword

27 February 2012 - 03:32 AM

If the hilt of your sword is positioned at the origin then you could simply rotate it on the x/y axis (the one along the sword edge) to achieve a simple swinging effect. Just have a swing rotation variable that you increase until it is at 90 degrees or so and then have it decrease back to zero. You could also use a timeline to move the model every step (not just rotation but transformation also) which could also become a full blown animation system which would come in handy later in the dev process (for enemies and other AI).