Mercurial > games > semicongine
comparison examples/E10_pong.nim @ 1136:71315636ba82
did: refactor naming in tons of places
author | sam <sam@basx.dev> |
---|---|
date | Tue, 04 Jun 2024 16:51:50 +0700 |
parents | 2ba3f18e7cad |
children | 114f395b9144 |
comparison
equal
deleted
inserted
replaced
1135:74957cbf589b | 1136:71315636ba82 |
---|---|
15 "color": Vec4F32, | 15 "color": Vec4F32, |
16 }.toTable) | 16 }.toTable) |
17 | 17 |
18 var | 18 var |
19 level: Scene | 19 level: Scene |
20 ballVelocity = newVec2f(1, 1).normalized * ballSpeed | 20 ballVelocity = NewVec2f(1, 1).normalized * ballSpeed |
21 | 21 |
22 when isMainModule: | 22 when isMainModule: |
23 var myengine = initEngine("Pong") | 23 var myengine = initEngine("Pong") |
24 | 24 |
25 var player = rect(color = barcolor, width = barWidth, height = barSize) | 25 var player = rect(color = barcolor, width = barWidth, height = barSize) |
86 ball.transform = ball.transform * translate(ballVelocity[0] * dt, ballVelocity[1] * dt, 0'f32) | 86 ball.transform = ball.transform * translate(ballVelocity[0] * dt, ballVelocity[1] * dt, 0'f32) |
87 | 87 |
88 # loose | 88 # loose |
89 if ball.transform.col(3).x - ballSize/2 <= 0: | 89 if ball.transform.col(3).x - ballSize/2 <= 0: |
90 ball.transform = scale(ballSize, ballSize, 1'f) * translate(30'f, 30'f, 0'f) | 90 ball.transform = scale(ballSize, ballSize, 1'f) * translate(30'f, 30'f, 0'f) |
91 ballVelocity = newVec2f(1, 1).normalized * ballSpeed | 91 ballVelocity = NewVec2f(1, 1).normalized * ballSpeed |
92 | 92 |
93 # bar | 93 # bar |
94 if ball.transform.col(3).x - ballSize/2 <= barWidth: | 94 if ball.transform.col(3).x - ballSize/2 <= barWidth: |
95 let | 95 let |
96 barTop = player.transform.col(3).y - barSize/2 | 96 barTop = player.transform.col(3).y - barSize/2 |