Giter Site home page Giter Site logo

rpgquiz's Introduction

RPG Quiz

We are building a written RPG on the basis of a quiz app for Android. The player is given choices using radio buttons. After a choice is made, he proceeds to make new choices. The objective is to make it so that people can add their own choices and create a large community made story

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • Android Studio

To install Android Studio for Windows/Max/Linux follow the instructions here at the official Android Developper Documentation instructions.

Installing

You can use a great tool, by cesarferreira called

  • dryrun

You can find it here on GitHub with all the instructions on how to use it and run an app

Alternatively you can run it on your Android device or an emulator with Android studio. You can find a tutorial by the Android Team in the Official Documentation here

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Stan Mihaljcuk - Initial work - Shoxtrem

See also the list of contributors who participated in this project.

Acknowledgments

  • Hat tip to anyone who's code was used
  • Inspiration
  • cesarferreira
  • Billie Thompson - Readme Template - PurpleBooth

License

This project is licensed under the MIT License - see the LICENSE.md file for details

rpgquiz's People

Contributors

fabiogouveia avatar bwaim avatar shoxtrem avatar dfrodri avatar gretagri avatar marialeoveanu avatar bytao7mao avatar

Stargazers

Peter Borowiec avatar  avatar  avatar Zofie Miller avatar  avatar  avatar Elisa avatar Amaël Sikel avatar  avatar

Watchers

James Cloos avatar  avatar  avatar Zsuzsanna Karap avatar Zofie Miller avatar

rpgquiz's Issues

Create level model

For Level Selection Screen to work I propose to create a level model.
I need this object to populate the CardViews on the:

Creation of the Level Selection Screen #issue6

My proposal for the initial template is:

Data members:
- levelName :String "Level textual name"
- questions : ArrayList<Question> "Questions list belonging to this level"
- score : int "Level score"
- locked : boolean " Level locked state "

API mutators:
+ setLevelName( levelName:String) : void "Set up the level name"
+ setScore( score : int) : void "Set up the level score"
+ setLocked( lock : boolean) : void "Set up the locked state"

API acessors:
+ Level(levelName:String, questions:ArrayList<Question>, score:int, locked:boolean) : Level
+ getLevelName:String "Return the level textual name"
+ getQuestions : ArrayList<Question> "Return a list with questions belonging to this level"
+ getScore : int "Return the level score"
+ isLocked :boolean "Return the locked status"

Support right-to-left layout

Remove the lint warning in all the layout.

  • Add layout_marginEnd when there is layout_marginRight and same for other directions

Create assets folder with JSON questions public database

I guys, I come up with an idea to make a wonderfull and fast public database using javascript object notation technology.
The porpose of this type of database is to be fast and as I know the fastest method to fetch remote databases is using JSON technology, another porpose is to ensure that everyone can see the questions data by simply visiting the assets folder on this github webpage.
In the code context this database will give us complete controle over the internet, even if someone download the app, put up and run it... It will never be possible to commit the altered file unless someone accept the commit and merge.
This arguments were what made me choose this option instead of a regular file storage type of db, SQLite dabase or the newest Room db implementation who whoul presiste in the phone storage memory.
Any way with this database system we will have the opportunity to implemente a simple but strong and reliable database system based on javascript objects, this will also give us the chance to change this json file to the internal presistence later, the only problem I see is that in order to have this file ready for both internal, external or web presistence, it was clear that we need a responsible class for that job a decoupled class that can separate the CRUD stuff from the rest. So I come up with another idea, I thougth about creating a class called QueryUtils and a utils package to store it, this class model will have the responsability of grant us a static way to fetch data, I will open another issue for this class.

Example of a Level object with one choice question and a character:

"Beginner" : {
       {
              "question" : "Example of a question...",
              "answer" : [
                      ["example of an answer", false],    //Wrong answer
                      ["example of an answer", false],    //Wrong answer
                      ["example of an answer", true],    //Right answer
                      ["example of an answer", false],    //Wrong answer
               ],
               "character" : "https://github.com/shoxtrem/RPGQuiz/tree/master/images/game_characters/some_character_image.png"
       }
}

Example of a Level object with multiple choice question:

"Beginner" : {
       {
              "question" : "Example of a question...",
              "answer" : [
                      ["example of an answer", true],    //Right answer
                      ["example of an answer", false],    //Wrong answer
                      ["example of an answer", true],    //Right answer
                      ["example of an answer", false],    //Wrong answer
               ]
       }
}

Example of a Level object with yes or no question:

"Beginner" : {
       {
              "question" : "Example of a question...",
              "answer" : [
                      ["yes", true],    //Right answer
                      ["no", false],    //Wrong answer
               ]
       }
}

Example of a Level object with a textual question:
The possible words map as to be divided by comma with no space betwen them, we going to use them on String split method and split the strings inside it by commas.

"Beginner" : {
       {
              "question" : "Example of a question...",
              "answer" : [
                      ["correct answer,another correct answer,another one", true],    //Second param always true
               ]
       }
}

If you all agree with that we have to start thinking about questions and designing characters for the game.

Harmonize code

  • write all variables in camelCase notation
  • write all OnClickListener as the one called submitClickListener in MainActivity.java

Working on menus

Got a really nice idea for them. Will post something when I've something done :D Hopefully in a few hours.

Errors corrections from previous merge

Error:(43, 67) error: cannot find symbol variable centerLanguage
Error:(44, 67) error: cannot find symbol variable languageLineOne
Error:(45, 69) error: cannot find symbol variable languageLineTwo

after clicking Setting icon in top right corner :

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.rpgquiz, PID: 19121
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setVisibility(int)' on a null object reference
at com.example.android.rpgquiz.MainActivity.languageSelector(MainActivity.java:47)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Create a QueryUtils class model

Hello guys...
I think this project needs a way to extract data from somewhere so I had the idea of create a QueryUtils class to hold CREATE, READ, UPDATE and DELETE responsability.
The purpose of this model is to give us a unique responsable for persistence data methods.
The purpose of this methods is to be static and can be called from anywhere.
From this implementation on you can fetch everything you want in a simple manner with this class.

Some examples of fetching:

//Get a level by name
Level level = QueryUtils.getLevel(context, levelName);

//Get all the game characters
ArrayList<GameCharacter> gameCharacters =QueryUtils.getCharacters();

//Get all the questions inside a level
ArrayList<Question> questions = level.getQuestions();

//Get question two, remember arrays start with index zero :)
Question question = questions.get(1);

//Get question two in lambda style (short sentence)
Question question = QueryUtils.getLevel(context, levelName).getQuestions().get(1);

//Get textual question
String textualQuestion = question.getQuestion();

//Get question score
int score = question.getScore();

//Get question character
int questionCharacter = question.getCharacter();

If you agree, I will start this task...

Create a Level Screen that never end's

I think the project needs a level selection screen to follow the project context and the project context says that we need some type of level selection screen that never ends with a bunch of different levels...ok that's nice...
So I come up with a proposal to make a level selection activity without xml, yes you ear that, without layout file...
All the layout will be constructed dynamically by code, I will use a Canvas surrounded by a SurfaceView to achieve this kind of feature we need, the canvas map layout will be like a chapter map where you can navigate through.
The user can navigate up and down through the map till it reaches the end and see some type of clouds that keep him from going higher, also the locked levels should appear with a different aspect ratio to alert the user that the level is locked, the levels will be unlocked as soon as the user passes the previous level.
The use of this activity will be a simple task, the level history designers have to think about when the history ends and when it ends they have to send the user back to this activity through an intent with extras that will tell this activity that the user passes a level, you also need to know that if we going to use this feature every history needs at least a couple of small drawables to represent the history level on this map.
To implement this feature I will change the questions.json file name to game.json and also change it's content to support this this kind of strategy.
I am also going to create a loading screen to give us time to fetch game data and inform the user we are doing something, in my vision we need this because as the game get's bigger we need to fetch more data and that takes time.

Hope you get the idea and like it...

Create Question model

For Level object to properly work I propose to create a Question model.
Level object need's to work with several instances of this question class.
This issue is related to:

Create Level model #issue14

My proposal for the initial template is:

Data members:

  • question : String "textual question"
  • possibleAnswer : String[] "Array of possible answers"
  • possibleAnswerState : boolean[] "Array of possible answers state"
  • passed : boolean " Question passed state "

API mutators:

  • setQuestion( question:String) : void "Set up a textual question"
  • setPassed( passed : boolean) : void "Set up the passed state"

API acessors:

  • Question(question:String, possibleAnswer : String[], possibleAnswerState : boolean[], passed:boolean) :Question "Return a new question instance"
  • getQuestion :String "Return a textual question"
  • passed : boolean "Return the passed state"
  • verifyAnswer( answer : String ) : boolean "Return if this answer is the correct answer"
  • verifyAnswer( answer : String[] ) : boolean "Return if this group of answers are the correct answers"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.