3D 3D sprite NEED HELP

S

slate31

Guest
Hi. This is my first time posting to the forums. Don't mind the health bar. I fixed that. (This is an early screenshot)

anyway. The left torch is supposed to change lighting. it should animate in a way that would make the flame move around a little bit.

I used the code from heart beast to get an understanding of how vector graphics worked. Nearly all code credited to him.

his tutorial that i used: https://www.google.com/url?sa=t&rct...rW13QGZDYVPpI1TE_A40sA&bvm=bv.139782543,d.amc

his website: http://www.heartbeast.co/


anyway. I was wondering why it wouldn't change animations. it just stays still. as if i did not even give the sprite any other images to work with. i've tried image speed and manually changing the image number as well. still nothing.

in create event of the torch object
/// draw 3d texture

torch_tex = sprite_get_texture(sprite_index,0);

An attempt and failure of step event of the torch object
image_speed= 10;

In the draw event of the torch object
/// draw torch

d3d_draw_block(x,y,32, x+32, y+32, 0, torch_tex, 1,1);


GameMaker_ Studio 10_28_2016 6_29_50 PM.png


ANOTHER QUESTION/ MYSTERY

My cheeseburger that i made on the right. It's a block. For 1, I dont know how to make the image align itself in any other way than in cube form. Is there a way to code a model for it to use? Secondly, the blue background of the cheeseburger is the room's background. So i suppose it is drawing it transparently. Any idea on how to fix it???


Create event of the cheeseburger object
/// draw 3d texture

burger_tex = sprite_get_texture(sprite_index, 0);

In the draw event of the cheeseburger object
/// draw burger

d3d_draw_block(x+8,y+8,16, x+24, y+24, 0, burger_tex, 1,1);

if distance_to_object( obj_player ) <=8

{
instance_destroy()
global.hp+=10;
}

(don'd mind the part where it says "if distance to object.." It's there just to add health. As you could tell.)

if there is any confusing code, heart beast's video will hopefully solve the misunderstanding.





Anyway. Help on this would be super appreciated. Ive spent a lot of time trying to find a similar problem from someone else, and i just cant seem to find one.

PLEASE HELP

THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:)
 
S

slate31

Guest
This is just a closer view of the cheese burger. Hope it helps!!!!!!!!!GameMaker_ Studio 10_25_2016 7_11_24 PM.png
 

Roa

Member
use draw_set_alpha_test to enforce proper ztesting with alpha.

as for drawing a flat sprite vs ab lock, just create a new model and rotate it using the wall function.

Code:
my_mod=d3d_model_create();
d3d_model_wall(my_mod,0,-8,16,0,8,0,1,1);
my_tex=sprite_get_texture(sprite_index,image_index);
Code:
//add a rotation matrix or use the d3d_transforms. Examples here use transforms cause Im lazy.

var  fdir=point_direction(x+16,y+16,player.x+16,player.y+16);
d3d_transform_set_identity();
d3d_transform_add_rotation_z(fdir);
d3d_transform_add_translation(x+16,y+16,0);
d3d_model_draw(my_mod,0,0,0,my_tex);
d3d_transform_set_identity();
 
C

Ctl-F

Guest
1: try changing your torch drawing code from
Code:
d3d_draw_block(x,y,32, x+32, y+32, 0, torch_tex, 1,1);
to
Code:
d3d_draw_block(x,y,32, x+32, y+32, 0, sprite_get_texture(sprite_index, image_index), 1,1);
The difference is before you were grabbing the first texture and constantly using that.
The code I gave grabs the current texture (according to image_index) every time it goes you draw.

As for your cheeseburger you can look into d3d_model_* functions if you feel like programmatically creating your model, or you can use an external model creator like blender, gm_mc, or the siv modeler. Most modeling programs don't have a game maker (unless they are created by/for game maker) but there are about a million and one obj import scripts for game maker. It's really up to you.
 
S

slate31

Guest
Hey! thank you both for the help!! im sorry for coming back so late. i wasn't expecting an answer soon.
 
S

slate31

Guest
1: try changing your torch drawing code from
Code:
d3d_draw_block(x,y,32, x+32, y+32, 0, torch_tex, 1,1);
to
Code:
d3d_draw_block(x,y,32, x+32, y+32, 0, sprite_get_texture(sprite_index, image_index), 1,1);
The difference is before you were grabbing the first texture and constantly using that.
The code I gave grabs the current texture (according to image_index) every time it goes you draw.

As for your cheeseburger you can look into d3d_model_* functions if you feel like programmatically creating your model, or you can use an external model creator like blender, gm_mc, or the siv modeler. Most modeling programs don't have a game maker (unless they are created by/for game maker) but there are about a million and one obj import scripts for game maker. It's really up to you.

Thanks! do you have any idea how to do the obj importing? or any good tutorials for making models.
 
Top