Jump to content


Osaifh

Member Since 05 Jul 2012
Offline Last Active Jul 05 2012 11:24 PM

Posts I've Made

In Topic: Problems about diferent parametres for one object

05 July 2012 - 10:35 PM

Oh my god, this is going horrible... After some tries, all I get is that when the tank shot the turret disapears for some seconds... I didn't understand the whole "turret_index" thing, i don't even know what is the image_index, can you help me please?

In Topic: Problems about diferent parametres for one object

05 July 2012 - 10:08 PM

There is something that I don't understand. What is the turret_index? Does it means that I have to put all the subimages of the turret in a single sprite? because currently I'm using two diferent sprites, one with 0 subimages used for the turret when it does nothing and the other one with 16 subimages for when the turret is shooting

In Topic: Problems about diferent parametres for one object

05 July 2012 - 09:28 PM

Alright, you'll need to create an additional variable for that. Continue to use sprite_index for the tank body's sprite, draw_self() will handle the rest.
Then, create a separate variable called "turret_sprite" or something in the create event of the tank object and set it to spr_turret. Whenever the turret shoots, instead of setting sprite_index to spr_turret_shooting (or whatever), set turret_sprite to spr_turret_shooting and set it back to spr_turret once it's done shooting. turret_sprite can now be used as the "sprite" argument of draw_sprite_ext, as it will hold the ID of the turret's current sprite, like this:

draw_sprite_ext(turret_sprite, 0, x, y, 1, 1, point_direction(x, y, mouse_x, mouse_y), c_white, 1); //Then, draw the turret on top of it.

Ok, so I made diferent variables acording to whatever has the tank to do. First, I set a variable called "movement", it's default value is 0. When it's 0, it draws the tank stopped. When I press up, it changes to 1, meaning that it's now being drawn the moving sprite. When I release up, it changes back to 0. The same thing happens with down, but the down value is 2
With the turret, I'm going to create two variables: one can be 0 or 1, 0 for the draw event to draw the turret in it's normal state, and 1 for when it's shooting, and another that can be true or false. When it shoots, it's changed to true. Then there will be an "animation end" event, that when it ends, if the second variable is true, it will change it to  false and the first one to 0.
Am I doing it right?

EDIT: wait, I doubt the "animation end" stuff would work, because the sprite is not the animation... oh ****, it wouldn't work. Help please, again

In Topic: Problems about diferent parametres for one object

05 July 2012 - 09:11 PM

Okay, thanks for everything, but now how Can I do to change the sprite of the body when it moves, and the sprite of the turret when it shoots?

In Topic: (D&D) Moving an instance between rooms

05 July 2012 - 08:55 PM

Make them all persistent, maybe? It's on the objects options