-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
46 lines (31 loc) · 882 Bytes
/
main.py
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
import random
import time
import numpy as np
from PIL import Image
import PySimpleGUI as sg
import pyautogui
import pyautogui as pag
import mouse
import keyboard
import BananaGenerics.bananaController as bCON
import settings
start_time = time.time()
screenWidth, screenHeight = pag.size()
# incase the banana gets out of hand,
def forceExit():
print("Force Close")
banana.bananaWin.Close()
exit()
keyboard.add_hotkey("ctrl + k", forceExit)
speedmultiplier = 20
banana_offset = 100
# main loop
banana = bCON.Banana(pos=[100, 220], basewidth=200)
lastTime = time.time_ns()
banana.bananaWin.setBananaFacingDirection('right')
print(banana.bananaWin.direction)
while True:
currentTime = time.time_ns()
deltaTime = (currentTime - lastTime) / settings.nano_const
lastTime = time.time_ns()
banana.bananastep(list(mouse.get_position()), deltaTime)