How do I create lives for a scene?

yelmusleh

  • Posts: 26
This is what I currently have. I am trying to get it so that when the timer reaches 0 it will take a "life" actor away from a row.

I want there to be four instances of the "life" actor, each one disappearing once the timer reaches 0. If it reaches 0 for all of them, then I want it to go to game over.

Photon

  • Posts: 2697
But what exactly isn't working?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

yelmusleh

  • Posts: 26
When you say spawn, I assume it means "Create Actor Type". However, when I tried doing that it didn't work when running the scene. When running the scene, there should be four instances of the life actor right?

Also, since the timer is built in the level, it is not a behavior, however the Life tutorial I built in a behavior which I then attached to an Actor Type.

So the Attributes I created in the behavior do not appear in the level where the timer is.

So simply issue one is that I can't make the life actor appear on the level, issue two is that I can't use attributes I created for the Life stuff in the level where the timer is.

Finally, I do not know how to code it so that when the timer ends, it ends the scene.

Photon

  • Posts: 2697
OK, let's tackle the drawing issue first.

So to clarify, no, you only want one of the life actor. We are using the lagless actor method: basically, we place that one actor and then let it draw its image multiple times instead of spawning multiple actors. So you spawn the one actor, it hides its initial image, and then draws copies of its image(s) in the appropriate spot.

The lagless actor method is detailed here: http://www.stencyl.com/help/viewArticle/163

So am I correct in saying that you are seeing no drawing at all? Or is it drawing in the wrong place? What values have you put in for your attributes (make sure the text attribute matches the name of your game attribute exactly too)?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

yelmusleh

  • Posts: 26
Thanks for the article link.

Okay to clarify with you.

You are correct in regards that I do not see any drawing at all. It does show up if I set the sprite to 'show', but when it is set to 'hide' it disappears.

I set the X Origin Attribute to 0.
I set the Y Origin Attribute to 0.
I set the X Offset Attribute to 10.
I set the LifeCountStorage Attribute to 4.

The four Attributes above are located in an actor behavior I created called 'GameLives'.
I then have 'GameLives' attached to my Actor called 'Life'.
Then I attached 'Life' to my test scene called 'Lives'.

Also, I am no longer using 'Create Actor Type'. Instead, I just added it directly onto the scene using the 'pencil' tool. If this won't work with your tutorial (Photon Game Development: Making a Pictoral Life Count), then I can change it.

Photon

  • Posts: 2697
Wait, the local Life Count Storage is supposed to be text, not a number. You store the GA name in that attribute as text, and then the purple GA block uses that text to identify which GA to read. Then make a properly named number GA that stores 4 as your total lives.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

yelmusleh

  • Posts: 26
It was already a text attribute. I just put in the number cause I have no idea what I am doing. Anyways, I went ahead and changed it back to zero. The lives are still not popping up however.

Photon

  • Posts: 2697
Hmm... try taking out the purple GA block altogether and just typing the number in there. Tell me if that changes anything.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

yelmusleh

  • Posts: 26

Photon

  • Posts: 2697
OH! I think I might see where you got mixed up...

The "LifeCountStorage" is NOT supposed to be the life count amount in text form. Rather, if your Game Attribute is named "LifeCount", then you were supposed to put "LifeCount" in that attribute, and then the purple block grabs that Game Attribute and its value. Is that where the confusion was?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

yelmusleh

  • Posts: 26
I am sure that is what it was, but you just lost me...

yelmusleh

  • Posts: 26
Oh now I see what you mean. I actually did it correctly. I had created LifeCountStorage and placed that attribute into the purple block. Then in the LifeCountStorage Attribute I set it to 4 for it to draw it 4 times. But it didn't work.

Photon

  • Posts: 2697
Oh now I see what you mean. I actually did it correctly. I had created LifeCountStorage and placed that attribute into the purple block. Then in the LifeCountStorage Attribute I set it to 4 for it to draw it 4 times. But it didn't work.
I'm still not sure we're on the same page.

Look at the pics below. The name of the game attribute pointed at in the first pic should match the text value of the "GA Name" attribute in your behavior, NOT the actual name of the behavior attribute itself.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

yelmusleh

  • Posts: 26
Okay... the first picture will be of the level one and how I incorporated the life attribute into it.

The second picture is of the life attribute itself (both created and drawing)

The third picture is the actual life attribute behavior.

Finally, the fourth picture is of level two.

I actually incorporated the timer into each of the levels. So the timer you see in the fourth image is actually on all the levels we created.

Hope this helps. If you need any other pictures I will be happy to send them over.

Photon

  • Posts: 2697
1. Why are the level one and level two timers different?
2. Are you making sure that the life actor is spawned in every scene?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!