I want to load a specific image, in this case I want my game to display an image of iron man, but only when the variable 'char' is set to iron man, which the player will set if they choose to play as him.
<Game2>:
name: "Avengers Tower"
FloatLayout:
Image:
source: "avengerstower.png"
This image code below is what i want to run when char is iron man
Image:
source: "ironmanhover.png"
pos_hint: {"x": .6, "y": .05}
size_hint: .4, .7
Label:
text: "You are in the Avengers Tower!"
pos_hint: {"x": .45, "y": .6}
font_size: "20dp"
color: (0,0,0,1)
size_hint: None, None
Button:
text: "North"
pos_hint: {"x": .45, "y": .85}
size_hint: None, None
height: 50
on_press:
root.manager.current = "AvengersCourtyard"
This code below is where the char value is set.
<Game>:
name: "main"
FloatLayout:
Image:
source: "choosecharacter.png"
Image:
source: "choosechar.png"
pos_hint: {"x": .3, "y": .25}
size_hint: .4, .8
Button:
text: "<- Back"
font_size: "15dp"
pos: 40, 510
size_hint: None, None
height: 50
on_press:
root.manager.current = "Title"
ToggleButton:
text: "Iron Man"
font_size: "15dp"
pos: 200, 150
size_hint: None, None
height: 80
group: "character"
on_press:
char = "Iron Man"
ToggleButton:
text: "Thor"
font_size: "15dp"
pos: 350, 150
size_hint: None, None
height: 80
group: "character"
on_press:
char = "Thor"
ToggleButton:
text: "Scarlett Witch"
font_size: "15dp"
pos: 500, 150
size_hint: None, None
height: 80
group: "character"
on_press:
char = "Scarlett Witch"
Button:
text: "Play!"
height: 50
font_size: "15dp"
pos: 650, 60
size_hint: None, None
on_press:
root.manager.current = "Avengers Tower"
These are the buttons above which are toggle ^^