Page 1 of 2

Help Killing My Player (right)

PostPosted: Wed Apr 25, 2007 2:01 am
by d-soldier
So I've got my map all finnished and I'm working on the whole player getting killed and spawnpoints and such... but heres my problem:

I expect my player to die (healthbar reaches zero) and as a destroy actor event a "dying player" actor is created to fall to the ground (stop at animation finnish).

What actually happens is:
When my player dies, the "dying actor" is created, but you only see it for a split second because the view follows destroyed player actor back to x0y0 of the map in a quick swooshing motion. I realize that this happens because the view is parented to a nondrawn object that is set to match the players movement (with a controlled weight for smoother transitions).

So, I figured (trying things before I ask here based on my limited understanding of GE coding) I would make a variable(actor) called "Alive"
and on my player create-actor script would have "Alive = 1" and the destory actor event would have "Alive = 0". Easy enough? So then my actor that smoothly follows the player (which the view is parented to) would have a draw-actor script as:
-------------------
int weight = 10;
if(Alive=1)
{
x = ((weight -1)*x + player.x)/weight;
y = ((weight -1)*y + player.y -25)/weight;
}
if(Alive=0)
{
x = ((weight -1)*x + player_die.x)/weight;
y = ((weight -1)*y + player_die.y -25)/weight;
}
-------------------
"player_die" is the dead player actor btw... But this does nothing in changing which actor the "smoothly following non-drawn actor" follows. So, here I am again asking any of you smart people for help. Please.

PostPosted: Wed Apr 25, 2007 2:11 am
by Sgt. Sparky
use must use == for if. :D

PostPosted: Wed Apr 25, 2007 2:19 am
by d-soldier
so it would be:
if(Alive==0) !?!? thats it!?

PostPosted: Wed Apr 25, 2007 3:00 am
by Sgt. Sparky
xD
:lol:
yes! :D

...

PostPosted: Wed Apr 25, 2007 4:14 am
by d-soldier
Now it treats my player like he's dead from the beginning... double checked the variable to be sure that the player "creation (and tried Draw) event" had "Alive=1;" abd the "destroy actor event" had "Alive=0;"... Something's not right here... :(
Edit: Tried "Alive==1; & Alive==0" as well.. no luck... help needed...

PostPosted: Thu Apr 26, 2007 12:55 am
by Sgt. Sparky
for a smooth view use the code you have,
but change the draw actor event for the view to,
Code: Select all
if(alive == 1)angle = direction(x + width / 2, y + height / 2, player.x, player.y);
directional_velocity = distance(x + width / 2, y + height / 2, player.x, player.y) / 5;
if(alive == 0)angle = direction(x + width / 2, y + height / 2, player_die.x, player_die.y);
directional_velocity = distance(x + width / 2, y + height / 2, player_die.x, player_die.y) / 5;

:D

nope

PostPosted: Thu Apr 26, 2007 1:13 am
by d-soldier
Cant just change the view... Background objects (sky, moving clouds, city, etc.) are following the "view_target" object (which the VIEW is parented to) .. So i need to modify that obecjt, not the view... but I'll take what you just said and see if I can apply it the right object,..

PostPosted: Thu Apr 26, 2007 1:14 am
by Sgt. Sparky
okay. :D

PostPosted: Thu Apr 26, 2007 1:21 am
by Game A Gogo
easy, change the parents!

PostPosted: Thu Apr 26, 2007 1:49 am
by d-soldier
Not THAT easy (wish it was).. too much going on with too many actors...

PostPosted: Thu Apr 26, 2007 1:50 am
by Sgt. Sparky
xD
what part of your game moves(other than the player)!? xD
and oh,
about that step thing,
make the backgrounds x = player.x / 2;
or somthing like that so it does not keep moving when the player runs into a wall. :D

eh!?

PostPosted: Thu Apr 26, 2007 1:53 am
by d-soldier
What step thing?!

PostPosted: Thu Apr 26, 2007 2:17 am
by Sgt. Sparky
where you wanted one of your backgrounds to move with each step your player made. xD

I dont...

PostPosted: Thu Apr 26, 2007 2:24 am
by d-soldier
I had it that way before, didn't like it... How it is now (with the weight adjustment, following my "view_target" is perfect, and super smooth.

PostPosted: Thu Apr 26, 2007 2:25 am
by Sgt. Sparky
:D
okay,
I am uploading my updated effect thingie with the grass fuzzy liked only it is scaled! :D