It looks like you're new here. If you want to get involved, click one of these buttons!
I'm new, so I apologize in advance for my lack of knowledge. I am trying to create a general trivia app with text boxes for answers. I'd also like to have a login page and leaderboard for the amount of time it takes to answer all questions. Are there any games like this with codes already written that I can emulate? Any help on login pages, or questions with text answers would be great!
Thanks!
Amy
Comments
Hi, Amy, no apologies necessary. We all start off knowing nothing about Codea.
I've edited your title so it will be clearer to forum users. There are plenty of past discussions about text boxes so I'm sure someone will help you with this.
@Stowell5005 Here's something I found searching the forum. Not sure if this is what you're after. In the table.insert lines of code, set up the question and the answer. You can have as many questions and answers as you want.
EDIT: Code changed to include updates.
Thank you so much! That is exactly what I am looking for in the question/answer part of my app. Any ideas on how to create a login page?
@Stowell5005 - programming this will require some knowledge of Lua (the language behind Codea) and tables (which provide arrays in Lua) in particular.
You will need one table for user names, passwords and scores, and another for questions and answers (or several, if you prefer).
Creating a login screen can be done with code similar to that above.
If you haven't done so, already, I suggest looking at the wiki page above to get a feel for Lua. Just ask if you get stuck.
@Stowell5005 - I should have added that to create a separate login screen, all you need is an "if" test in the draw function that decides whether to draw the login or the questions screen. eg you could have a variable called state, and set it to 1 for login and 2 for questions, 3 for end of questions, and 4 for leaderboard, then the draw function can look at it and draw whichever screen applies.
@Stowell5005 I made changes to the code above. Do those fit your needs better.