Help Killing My Player (right)

Game Editor comments and discussion.

Help Killing My Player (right)

Postby d-soldier » Wed Apr 25, 2007 2:01 am

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.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Wed Apr 25, 2007 2:11 am

use must use == for if. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby d-soldier » Wed Apr 25, 2007 2:19 am

so it would be:
if(Alive==0) !?!? thats it!?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Wed Apr 25, 2007 3:00 am

xD
:lol:
yes! :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

...

Postby d-soldier » Wed Apr 25, 2007 4:14 am

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...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Thu Apr 26, 2007 12:55 am

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
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

nope

Postby d-soldier » Thu Apr 26, 2007 1:13 am

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,..
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Thu Apr 26, 2007 1:14 am

okay. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Game A Gogo » Thu Apr 26, 2007 1:21 am

easy, change the parents!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby d-soldier » Thu Apr 26, 2007 1:49 am

Not THAT easy (wish it was).. too much going on with too many actors...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Thu Apr 26, 2007 1:50 am

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
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

eh!?

Postby d-soldier » Thu Apr 26, 2007 1:53 am

What step thing?!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Thu Apr 26, 2007 2:17 am

where you wanted one of your backgrounds to move with each step your player made. xD
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

I dont...

Postby d-soldier » Thu Apr 26, 2007 2:24 am

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.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Thu Apr 26, 2007 2:25 am

:D
okay,
I am uploading my updated effect thingie with the grass fuzzy liked only it is scaled! :D
Last edited by Sgt. Sparky on Thu Apr 26, 2007 2:27 am, edited 1 time in total.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron