mirror of
https://github.com/tilleul/apple2.git
synced 2024-06-10 04:29:29 +00:00
Update README.md
This commit is contained in:
parent
206c348102
commit
4a419e9a45
|
@ -50,3 +50,27 @@ The main problem is that the code goes through ALL of the coordinates testing fo
|
|||
```
|
||||
|
||||
It should be noted that although Z holds the zone number where the spaceship is, this variable is not used for anything else but testing if it's non-zero (in which case the spaceship is in none of the zones, thus out of the maze) and also that Z is not even properly set as lines 135 to 142 all set Z to 6 as if it was the same zone. Also, the comments indicate that there are 11 zones when in fact there are 16. It looks like during the development the maze was modified from 11 to 16 zones. And one last thing, some zones limits overlap but that's ok.
|
||||
|
||||
## Fixing the game
|
||||
So the first thing that comes to mind is that once you know in which zone the spaceship is, you need to skip all the other tests. Simply putting a "GOTO 175" at the end of each test line is enough. Running the program with the sound on for the spaceship will prove you that this was really the main bottleneck ! You can already notice how the spaceship is now much more responsive.
|
||||
|
||||
```basic
|
||||
100 IF (X > = 10 AND X < = 80) AND (Y > = 80 AND Y < = 100) THEN Z = 1: GOTO 175
|
||||
110 IF (X > = 60 AND X < = 100) AND (Y > = 100 AND Y < = 120) THEN Z = 2: GOTO 175
|
||||
120 IF (X > = 80 AND X < = 100) AND (Y > = 120 AND Y < = 158) THEN Z = 3: GOTO 175
|
||||
125 IF (X > = 100 AND X < = 140) AND (Y > = 140 AND Y < = 158) THEN Z = 4: GOTO 175
|
||||
130 IF (X > = 120 AND X < = 180) AND (Y > = 120 AND Y < = 140) THEN Z = 5: GOTO 175
|
||||
135 IF (X > = 160 AND X < = 220) AND (Y > = 140 AND Y < = 158) THEN Z = 6: GOTO 175
|
||||
137 IF (X > = 200 AND X < = 220) AND (Y > = 110 AND Y < = 140) THEN Z = 6: GOTO 175
|
||||
138 IF (X > = 220 AND X < = 265) AND (Y > = 110 AND Y < = 130) THEN Z = 6: GOTO 175
|
||||
139 IF (X > = 245 AND X < = 265) AND (Y > = 40 AND Y < = 110) THEN Z = 6: GOTO 175
|
||||
140 IF (X > = 215 AND X < = 245) AND (Y > = 40 AND Y < = 60) THEN Z = 6: GOTO 175
|
||||
141 IF (X > = 215 AND X < = 235) AND (Y > = 60 AND Y < = 100) THEN Z = 6: GOTO 175
|
||||
142 IF (X > = 180 AND X < = 235) AND (Y > = 80 AND Y < = 100) THEN Z = 6: GOTO 175
|
||||
145 IF (X > = 180 AND X < = 200) AND (Y > = 60 AND Y < = 100) THEN Z = 8: GOTO 175
|
||||
150 IF (X > = 140 AND X < = 180) AND (Y > = 60 AND Y < = 80) THEN Z = 9: GOTO 175
|
||||
160 IF (X > = 100 AND X < = 160) AND (Y > = 40 AND Y < = 60) THEN Z = 10: GOTO 175
|
||||
162 IF (X > = 100 AND X < = 120) AND (Y > = 60 AND Y < = 80) THEN Z = 11: GOTO 175
|
||||
```
|
||||
|
||||
Test for yourself, here's the code: [spacemaze_quickfix.bas](./spacemaze_quickfix.bas)
|
||||
|
|
Loading…
Reference in New Issue
Block a user