Add lives in quiz app

Hi. I am having trouble working on our game app that is needed for school. How do you make the lives button work?

Can you say more briefly?

we created a button for lives on our game app. Unfortunately, it is not working. Whenever we answer the questions incorrectly, it should lessen the lives but it just stays with three

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

here

Show your relevant blocks, ie. those to do with lives.

you are using my quiz tutorial from here https://puravidaapps.com/quiz.php
to answer your question see Q1 there App Inventor Tutorials and Examples: Advanced Features | Pura Vida Apps
Taifun

I used the lives blocks in your quiz tutorial, but I am still confused on how we got it wrong

Hi! I have already asked this a couple of times in this forum, but still no luck in making our lives work. I have copied the blocks from the link that we used for our app but the lives label is not working even though I did everything that I could think of...

here is the link that we used for our game app: https://puravidaapps.com/quiz.php

  • Are your Blocks identical to the Blocks showed in the gameover Procedure? If you copied incorrectly or changed the questions/answers, an incorrect gameover Procedure is most likely.
  • Did you modify the tutorial code? Try an un-modified version.

Did you download and try the aia file shown at the bottom of Taifun's post. If you run that aia in the Companion, what happens when you answer all the questions?

Compare your Blocks to Taifun's

. Looks like you did not include something.. :frowning:

I've already added that after I posted in this forum a week ago. But the lives are still not working:(

...and you changed the names of some of the Blocks. :cry:

so, still not working. It is apparent you did something wrong. You didn't share all your Blocks so the only person that will debug your app is you. A guess is you have other Block issues; only you can test. If you replicate Taifun's tutorial exactly, with not changes and you add an exact copy of the select Procedure; does the 'lives' work? If not, do a DoIt debugging and find out what is wrong.

how do you do the dolt debugging?

anyways here are our current blocks:

Right click on a variable Block
Select DoIt from the dropdown

..shows what is contained in the variable.
Here I am clicking on global listADoIt2

Taifun's explanation showing how to 'add lives' or show lives left is a puzzle he provided for developers to figure out. I came up with my own solution using some of his advice. :slight_smile:

I use a Notifier to display the number of 'lives' left during play and at the end of the game (this is the display shown at the end of the quiz):


.
How to reproduce it: Start with Taifun's tutorial original code and add some of the Blocks from his Question#1 selected Procedure. Ignore the actual selected Procedure (but use some of the Blocks in it). Add a Notifier to the Designer. Carefully add and remove some blocks according to this model and create something similar to a 'lives button' (whatever that is).

.

Good luck. Perhaps you already solved Taifun's puzzle. If not, start with Taifun's unmodified example and make the suggested modification and get it to work. Then, and only then add the 'lives' to your modified quiz.

1 Like

Thank you so much. The lives are already working.

May I ask something? What can I do if my I want (for example) that if the player reached 0 lives, it will go to another screen? I already tried adding it in the not already handled blocks but it just goes to a runtime error. And if they didn't reached 0 lives they will still go to another screen but for victory? Again. thank you so much

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.