Problem with VisibilityState

Non-platform specific questions.

Problem with VisibilityState

Postby msv83 » Sun Nov 09, 2008 4:40 pm

I have a problem with a VisibilityState code, and I'm sure it may just be a minor thing I've overlooked or haven't understood that makes this not working correctly.

Here's what I'm trying to do: the actor have three lives, and it shows as hearts in the top corner, divided in three images: one showing one heart, second showing two, third showing three. When the actor, who begins with three hearts and three lives lose one life, the image with three hearts is disabled with a Visibilitystate action, the same goes for the other images. This works fine. But when I try to give the actor extra lives (by picking up a life item for example), the actor does get an extra life, but I can, for some reason, not make it work so the heart images are turned visible again. Like, if actor has only 2 lives now, picks up a life, he have three lives, which should enable the image with three hearts on it.

In short: I can use the VisibilityState to make the images turn invisible, but not making them appear again.

Here's the code I use for each of the three images:

if (health < 3)VisibilityState("Event Actor", DISABLE);
if (health < 2)VisibilityState("Event Actor", DISABLE);
if (health < 1)VisibilityState("Event Actor", DISABLE);

Which works fine, when the actor lose the first life the image with three hearts disappears leaving to hearts left, when the actor lose the second the image with the two hearts disappears leaving one heart left, etc.

But how to make them appear again? Say, if actor's health is 2, and gets one life, how to make the image with three lives visible again? I've tried several codes but each have failed.

Big thanks in advance for any help you can offer me :)
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score

Re: Problem with VisibilityState

Postby jimmynewguy » Sun Nov 09, 2008 5:21 pm

just make lives 1 animation with three hearts then 2 hearts than 1 heart and when you lose a life animpos -- ;
and animpos ++; when you gain a life thats how i do it(if you understand i talk really confusingly) :lol:
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Problem with VisibilityState

Postby msv83 » Sun Nov 09, 2008 7:46 pm

Thank you very much! :D
msv83
 
Posts: 22
Joined: Mon Dec 31, 2007 3:17 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron