Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | Rem Setup sync |
2 | Sync On |
||
3 | Sync Rate 30 |
||
4 | |||
5 | Rem Create matrix |
||
6 | Make Matrix 1,2000,2000,50,50 |
||
7 | |||
8 | Rem Position Camera above the matrix |
||
9 | Position Camera 0,1000,0 |
||
10 | |||
11 | JumpKeyStatePrev = 0 |
||
12 | |||
13 | positionY = 175.0 |
||
14 | velocityY = 0.0 |
||
15 | gravity = 1 |
||
16 | onGround = 1 |
||
17 | |||
18 | Do |
||
19 | JumpKeyStateNow=leftkey() |
||
20 | if (JumpKeyStatePrev=0) and (JumpKeyStateNow=1) |
||
21 | gosub startJump |
||
22 | ENDIF |
||
23 | |||
24 | if (JumpKeyStatePrev=1) and (JumpKeyStateNow=0) |
||
25 | gosub endJump |
||
26 | ENDIF |
||
27 | |||
28 | JumpKeyStatePrev = JumpKeyStateNow |
||
29 | |||
30 | |||
31 | gosub JumpUpdate |
||
32 | |||
33 | position camera 0, positionY, 0 |
||
34 | |||
35 | Sync |
||
36 | Loop |
||
37 | |||
38 | StartJump: |
||
39 | if onGround=1 |
||
40 | velocityY = 25.0 |
||
41 | onGround = 0 |
||
42 | endif |
||
43 | return |
||
44 | |||
45 | EndJump: |
||
46 | if velocityY > 6.0 then velocityY = 6.0 |
||
47 | return |
||
48 | |||
49 | JumpUpdate: |
||
50 | dec velocityY, gravity |
||
51 | inc positionY, velocityY |
||
52 | |||
53 | if positionY < 175.0 |
||
54 | positionY = 175.0 |
||
55 | velocityY = 0.0 |
||
56 | onGround = 1 |
||
57 | endif |
||
58 | return |
||
59 | |||
60 | |||
61 |