-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.kt
More file actions
46 lines (35 loc) · 1.7 KB
/
MainActivity.kt
File metadata and controls
46 lines (35 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.example.gameideagenerator
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
val genre = arrayOf("FPS", "Action", "Adventure", "Horror", "RPG", "MMORPG", "Stealth", "Puzzle", "Side-Scroller", "Platformer")
val main_character = arrayOf("Dragon", "Dog", "Bird", "Snail", "Cube", "Sphere", "Loner", "Swordsmen", "Chef", "Knight")
val objective = arrayOf("Capture the flag", "Search and Destroy", "Search and Rescue", "Survive", "Save Everyone",
"Race the Clock", "Solve a Puzzle", "Escape", "Explore")
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Buttons and Text Variables
val objectiveButton = findViewById<Button>(R.id.Objective)
val genreButton = findViewById<Button>(R.id.Genre)
val characterButton = findViewById<Button>(R.id.Character)
val genreTextView = findViewById<TextView>(R.id.genreText)
val characterTextView = findViewById<TextView>(R.id.characterText)
val objectiveTextView = findViewById<TextView>(R.id.objectiveText)
// Button Functionality
genreButton.setOnClickListener {
val rand = genre.random()
genreTextView.text = rand
}
characterButton.setOnClickListener {
val rand1 = main_character.random()
characterTextView.text = rand1
}
objectiveButton.setOnClickListener {
val rand2 = objective.random()
objectiveTextView.text = rand2
}
}
}