-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
93 lines (75 loc) · 2.26 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import pygame as py
import math
import sys
import os
from boundary import Boundary
from ray import Ray
from dataLayer import DataBaseHandle
import colors
from mainThread import MainThread
from threading import Thread
from particle import Particle
import random
from block import Block
map = [[0,0,0,0,0,0,0,0,0,0],
[0,1,0,1,0,0,1,0,1,0],
[0,1,0,1,1,1,1,0,1,0],
[0,1,0,1,0,0,0,0,1,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,1,0,1,0,0,0,0,1,0],
[0,1,0,1,1,1,1,0,1,0],
[0,1,0,1,0,0,1,0,1,0],
[0,0,0,0,0,0,0,0,0,0],
]
def initialitation(caption):
py.init()
py.display.set_caption(caption)
def updateActionsThread(hilo):
while 1:
break
def intersection(wall, ray, display):
pt = ray.cast(wall)
if(pt):
py.draw.circle(display, colors.WITHE, (int(pt.x), int(pt.y)), 5)
def drawWall(surface, color, walls):
for wall in walls:
wall.show(surface, color)
def makeMap():
contx = 0
conty = 0
for y in map:
for x in y:
if x == 1:
map[conty][contx] = Block(45 * contx, 45 * conty)
contx += 1
contx = 0
conty += 1
return map
def recorrer():
ground = []
for x in map:
for y in x:
if y != 0:
for m in y.walls:
ground.append(m)
return ground
def main():
initialitation("RayCast")
conn = DataBaseHandle.__conn__()
display = py.display.set_mode([400, 400])
time = py.time.Clock()
running = 1
makeMap()
particle = Particle(600, 450, display, colors.GRAY, recorrer())
hilo = MainThread([
[display.fill, [colors.BLACK]],
[particle.show, []],
[drawWall, [display, colors.WITHE, recorrer()]],
#[recorrer, [display, colors.WITHE, mapat]],
[py.display.flip, []],
[time.tick, [64]],
], py)
t1 = Thread(name="non-block", target=updateActionsThread, args=(hilo,))
t1.start()
hilo.mainThread()