|
Post by Xenith on May 20, 2006 22:50:19 GMT -5
Since everyone seems to be quiet, i'm thinkin' of doing a little project to get into the 3d stuff, but i don't want to ask at the gmc, since everyone's so uptight there. Anyways, i wanna make a 3d game, but i want it to have an overhead view like zelda, secret of mana, or pretty much any 2d rpg. also since there's not much going for Game Maker in the polygon intense graphics department, i want to make the characters 2d i've seen this one example forums.gamemaker.nl/index.php?showtopic=209363but what he did was make a wall have a texture on it, and i tried to put in an animated sprite but it would always stay on one frame. then i checked out this one forums.gamemaker.nl/index.php?showtopic=201957&hl=but i couldn't fin out what code did exactly what in it. hope you understood what i was saying. .
|
|
|
Post by Jam on May 21, 2006 5:17:50 GMT -5
to make it animated put
tex = sprite_get_texture(spr_player,image_index); in the draw function instead of the create function. On jools example for some reason you have to set the image speed or it doesnt work, i used
image_speed = room_speed in create event.
|
|
|
Post by Xenith on May 21, 2006 10:20:36 GMT -5
thanks, that worked. i'm gonna test out some other stuff
[edit]
okay i got another question, i've been fiddlin around with this stuff, and made sense of alot of it. but i don't know why i can't make it so the animations stop when the buttons aren't pressed and move when they are
the last gm i used was 5.4 or something, it was the last one before 6.
anyways i don't know if they changed how the if cases and the bracketing or something
|
|
|
Post by IsmAvatar on May 21, 2006 22:23:31 GMT -5
5.3c
The if statements and cases and such remain the same. Some functions and variables and such have been deprecated. One of which you should really look out for is image_single, which was deprecated in the switch from 5.3 to 6, in favour of image_index and image_speed (used together). If you still use this function, it will work, but may produce unexpected results.
|
|
|
Post by Xenith on May 21, 2006 22:48:03 GMT -5
what i tried to do was check whether the buttons were being pressed and if none of them were the image_single would go to 0, i dunno though, it seemed to keep the character on ths still frame.
|
|
|
Post by IsmAvatar on May 23, 2006 0:14:12 GMT -5
like i said, image_single was deprecated and may not work as expected. You should replace every occurance of it with its image_speed and image_index counterparts.
image_single = a converts to: image_speed = 0 image_index = a
image_single = -1 converts to: image_speed = 1 //or whatever image_speed is normally
My website has a movement script called Priorities Movement or something which I had to remove the link to when I updated it because I had used image_single, and it no longer worked.
|
|
|
Post by Xenith on May 27, 2006 20:31:15 GMT -5
thanks, what i had was this x1 = x-8; x2 = x+8; y1 = y; y2 = y; z1 = 16; z2 = 0; global.randix = randi.x global.randiy = randi.y if global.randi_dir = "left" {tex = sprite_get_texture(randi_left,-1)} if global.randi_dir = "right" {tex = sprite_get_texture(randi_right,-1)} if global.randi_dir = "down" {tex = sprite_get_texture(randi_down,-1)} if global.randi_dir = "up" {tex = sprite_get_texture(randi_up,-1)} if (not keyboard_check(vk_up) and not keyboard_check(vk_down) and not keyboard_check(vk_left) and not keyboard_check(vk_right)) {image_single=0}
i just exchanged image_single with image_index and it works great now.
|
|
|
Post by Xenith on May 28, 2006 23:08:12 GMT -5
what happened to the draw_text_sprite function?
also if this still works, how could i get it to work in 3d? do i just add z to it?
create
alarm[0] = room_speed image_speed = .3
alarm0
if random(2) < .5 { speed = 0 } else { direction = floor(random(4)) * 90 speed = 3 } alarm[1] = room_speed
alarm1
speed = 0 alarm[0] = room_speed
step
switch direction { case 0: sprite_index=g_hair_girl_right;break; case 90: sprite_index=g_hair_girl_up;break; case 180: sprite_index=g_hair_girl_left;break; case 270: sprite_index=g_hair_girl_down;break; } if (speed = 0) then {image_speed = 0;} else {image_speed = .3} depth = -y + sprite_height if image_speed = 0 then image_single = 0 else image_single = -1
collision event with hero makes the npc bounce collision event with block makes the npc bounce
[edit] if x < view_left[0] { x = view_left[0] } if x > view_left[0] + view_width[0] { x = view_left[0] + view_width[0]} if y < view_top[0] { y = view_left[0] } if y > view_top[0] + view_height[0] { y = view_top[0] + view_height[0]}
what have those functions been replaced with?
|
|
|
Post by shad0w on May 29, 2006 0:46:12 GMT -5
view_left=view_xview view_top=view_yview view_width=view_wview view_height=view_hview
I think draw_text_sprite is still there, or an equivalent- I remember using it just recently.
Im not sure what your other question is.
|
|
|
Post by IsmAvatar on May 29, 2006 12:49:43 GMT -5
To make something 3d, you need to add a draw event to it. You handle all the 3d drawing yourself using the d3d_ functions.
|
|
|
Post by Xenith on May 29, 2006 19:39:30 GMT -5
thanks,
i know how to make things 3d, but i thought, that -x and -y etc all worked in the 3d world and i was just wondering and i was just wondering if i'd have to bother adding the z axis if i wasn;t needed.
|
|
|
Post by shad0w on May 29, 2006 23:34:35 GMT -5
Nope, it's not needed if you simply decide to not have any varying heights.
|
|
|
Post by Xenith on May 30, 2006 0:21:35 GMT -5
thanks
|
|
|
Post by IsmAvatar on May 30, 2006 12:00:09 GMT -5
not needed, just put a 0 in there every time it asks for z - except for the camera, in which case you'd put a 1 in for the yaw z.
|
|
|
Post by Xenith on Jun 3, 2006 0:55:48 GMT -5
okay, image_single was workin for me, but i could never change the speed no matter what i used. (unless I changed the room speed)
so i tried image_index = -1 and image_speed = 1 but then the sprite would keep getting stuck on the 6th frame, is there like a new code to get it to cycle?
[edit] i fixed it but i'm not sure how the animation cycles through even though i didn't tell it to. does it do it automatically now?
here's the coding
create
image_speed = .4
step
if (not keyboard_check(vk_up) and not keyboard_check(vk_down) and not keyboard_check(vk_left) and not keyboard_check(vk_right)) {image_index=0}
left
x-=4 sprite_index = boy_wleft
up
y-=4 sprite_index = boy_wup
right
x+=4 sprite_index = boy_wright
down
y+=4 sprite_index = boy_wdown
i tried putting image_index = -1 and image_speed = 1 in the directional buttons but the nimation would just stop on the first frame, but i removed them and they worked. so does anyone know exactly what in my coding got the sprite to animate?
|
|