f
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
class avatar:
|
||||||
|
def __init__(self, name, groesse):
|
||||||
|
self.name = name
|
||||||
|
self.groesse = groesse
|
||||||
|
self.items = None
|
||||||
|
self.Fahrzeug = None
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return("I am "+ self.name)
|
||||||
|
|
||||||
|
def fahrzeug_zuweisen(self,fahrzeug):
|
||||||
|
self.fahrzeug = fahrzeug
|
||||||
|
|
||||||
|
def item_aufheben(self):
|
||||||
|
self.items
|
||||||
|
print("you picked a" + self.items)
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
class fahrzeug:
|
||||||
|
def __init__(self, name, geschwindigkeit, groesse):
|
||||||
|
self.name = name
|
||||||
|
self.geschwindigkeit = geschwindigkeit
|
||||||
|
self.groesse = groesse
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return("You chose: "+ self.name)
|
||||||
|
|
||||||
|
def fahren(self):
|
||||||
|
print("i'm driving")
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class items:
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return (self.name)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
from avatar import avatar
|
||||||
|
from fahrzeug import fahrzeug
|
||||||
|
from items import items
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
|
print("Welcome to Mario-Kart!!!")
|
||||||
|
|
||||||
|
character_selection = ["mario", "luigi"]
|
||||||
|
vehicle_selection = ["auto","motorrad"]
|
||||||
|
itemlist = ["banana", "bomb", "turtleshell"]
|
||||||
|
|
||||||
|
mario1 = avatar("Mario",112)
|
||||||
|
luigi2 = avatar("Luigi", 124)
|
||||||
|
|
||||||
|
bike = fahrzeug("Bike", 100, 175)
|
||||||
|
kart = fahrzeug("Kart", 110, 200)
|
||||||
|
|
||||||
|
banana = items("Banana")
|
||||||
|
bomb = items("Bomb")
|
||||||
|
turtleshell = items("turtleshell")
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
character = int(input("Choose your avatar: 1 or 2" + str(character_selection)))
|
||||||
|
|
||||||
|
if character == 1:
|
||||||
|
selected_avatar = mario1
|
||||||
|
elif character == 2:
|
||||||
|
selected_avatar = luigi2
|
||||||
|
else:
|
||||||
|
print("Invalid choice.Defaulting to Mario.")
|
||||||
|
selected_avatar = mario1
|
||||||
|
|
||||||
|
if int(character) > 2:
|
||||||
|
print("Please choose the numbers 1 or 2")
|
||||||
|
selected_avatar = None
|
||||||
|
|
||||||
|
vehicle = int(input("Choose your vehicle: 1 or 2" + str(vehicle_selection)))
|
||||||
|
|
||||||
|
if vehicle == 1:
|
||||||
|
selected_vehicle = kart
|
||||||
|
elif vehicle == 2:
|
||||||
|
selected_vehicle = bike
|
||||||
|
else:
|
||||||
|
print("Invalid choice. Defaultiung to kart.")
|
||||||
|
|
||||||
|
if int(vehicle) > 2:
|
||||||
|
print("Please choose the numbers 1 or 2")
|
||||||
|
|
||||||
|
|
||||||
|
print(f"You chose: {selected_avatar.name} and the {selected_vehicle.name}")
|
||||||
|
|
||||||
|
for i in range(3, 0, -1):
|
||||||
|
print(i)
|
||||||
|
time.sleep(1.5)
|
||||||
|
print("GO!")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
item1 = items(itemlist[random.randint(0,2)])
|
||||||
|
print("You picked up a "+ str(item1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user