Fixup error
BlitzMax Forums/BlitzMax Beginners Area/Fixup error
| ||
| Hello, I am new to game programming and am having a lot of fun with blitzmax. My game runs fine as it stands. However, if I add any more lines of code to my main loop I get the following error when I compile: 10682:Fixup of -32856 too large for field width of 16 bits As my game isnt finished, this is a bit of a problem. I started off coding procedurally (I've done a little sysadmin scripting before) but soon tried an Object Oriented style. Hence the Player1 ship is not an object and coded in the main loop, whereas other things are objects. Below is a brief outline of my program flow in summary form. I'm hoping there is an obvious flaw in my approach that may cause this error and someone can kindly put me straight. What does the error mean and how can I avoid it in future? Is it related to the nested While....Wend loops?
Define graphics
Define Types (currently 8 types)
Initialize pre-game variables (create lists, incbin, read hi-score file)
While not Keydown(Key_escape)
flip, cls
draw title screen
wait for key - if "1" the play_game=1, if "esc" game will bomb out due to outer while loop. If nothing we loop back round
initialize vars
While play_game=1
cls
clear all type lists (all enemies, stars, etc destroyed)
While not player1_left=0
reset enemies and screen if player just died (IF..THEN)
While loop to create enemies (amount based on level - objects with Type)
Wend
Draw game screen
Key analysis - Key(left) = move player 1 left, Key(right) = move player 1 right. This code is here - player1 not an object - procedural code
Ship positional anaysis. This code is here - player1 not an object - procedural code
While stars < 100
draw stars (object with Type)
Wend
If key Z - create ship fire (object with Type)
For each in starlist
update
next
For each in big enemy list
update movement and direction
check collision with player1
For each ship fire object
check collision with this specificbig enemy + remove both if collision + create 3middle enemies + create debris
Next
Next
For each in middle enemy list
update movement and direction
check collision with player1
For each ship fire object
check collision with this specific middle enemy + remove both if collision + create 3 smaller enemies + create debris
Next
Next
For each in small enemy list
update movement and direction
check collision with player1
For each ship fire object
check collision with this specific small enemy + remove both if collision + create debris
Next
DrawImage small enemy
Next
For each in debris list
update movement and direction
check collision with walls + remove if collision
Next
For each ship fire object list
check collison with walls and remove if collison
Next
FLIP
CLS 'For the main game
if player_just_died=1
remove all objects from lists
player1_left=player1_left-1
play player 1 ship explosion animation (needs 10 Flips and 10 cls in while loop)
endif
if player1_left=0
update hi-score file if necessary
draw game over splash screen
Remove all objects from lists
Endif
FlushMem()
WEND 'player1_left=0
WEND ' play_game=1
WEND 'escape key
Many Thanks, Dave. |
| ||
| I am also new to programming (totally) but in the interest of participating in the forum my suggestion would be to move a lot of your code into functions() outside your main loop. Although my first game is only 190 lines of code including a dozen or so blank lines my main loop looks like this: Repeat If KeyHit(1) If MouseX()<176 pick=1 checkhit() masterscore:+score ElseIf MouseX()>201 And MouseX()<307 pick=2 checkhit() masterscore:+score ElseIf MouseX()>332 And MouseX()<438 pick=3 checkhit() masterscore:+score ElseIf MouseX()>463 pick=4 checkhit() masterscore:+score End If End If If timer=60 bonus() drawlines() drawstates() drawcapitals() SetScale 1.5,1.5 If timer=0 And n=5 Local myChannel = PlaySound (tick) DrawImage numtiles,559,59,tilearray3[n] DrawText"Total Score = "+masterscore,58,70 DrawText"Speed Bonus:",410,70 SetScale 1,1 Flip FlushMem Cls timer:+1 score=0 Until KeyHit (key_space) I hope you can get some use out of my suggestion. |
| ||
| Thanks Emmett. I appreciate the advice. I'm convinced that moving to functions wont sort the fixup error though (although it will make it more readable). I'll test it this evening. |
| ||
| Shows you how much I know! Thanks Emmett, moving to functions appears to have fixed the problem. |
| ||
| >Shows you how much I know! Thanks Emmett, moving to >functions appears to have fixed the problem. So is the conclusion that the main loop can only be a (small) certain size? Andy |