I have a small game I'm working on and I made it so when you aim the gun changes spots and is more centered but when I do that, the first image of a gun is still there.
Here is the code:
gun1 = True
if gun1 == True:
gun1 = Entity(model="assets/gun.obj", parent=camera.ui, scale=.03, color=rgb(0, 0, 139), position=(.5, -.7),
rotation=(-5, 5, 1))
if gun1 == False:
gun1 = Entity(model="assets/gun.obj", parent=camera.ui, scale=.03, color=rgb(0, 0, 139), position=(20, 20),
rotation=(-5, 5, 1))
def input(key):
if key == 'escape':
quit()
if key == "left mouse down":
Audio("assets/GunShot.mp3")
Animation("assets/spark", parent=camera.ui, fps=5, scale=.1, position=(.34, -.19), loop=False)
if key == "right mouse down":
gun2 = Entity(model="assets/gun.obj", parent=camera.ui, scale=.03, color=rgb(0, 0, 139), position=(.00, -.726),
rotation=(-5, 1, -1))
gun1 == False
You can see at the end it says 'gun1 == False' and I thought that should make the first one disappear but it doesn't.