Qbasicnews.com

Full Version: borders
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
im creating a little game and i ned borders for the edges, hjeres wat im using:
IF charx% < 0 THEN charx% = 0
IF charx% > 303 THEN charx% = 319
IF chary% < 0 THEN chary% = 0
IF chary% > 183 THEN chary% = 199

the char sprite is 16x16, the top anf left borders work, but the bottom and rite dont seem to want to work, as soon as it gets close, it returns to the editor and sais illegal function or something like that
that border code works well.....you may have to post more code if you want further help

Oz~
Quote:IF charx% < 0 THEN charx% = 0
IF charx% > 303 THEN charx% = 319
IF chary% < 0 THEN chary% = 0
IF chary% > 183 THEN chary% = 199
Code:
IF charx% < 0 THEN charx% = 0
IF charx% > 303 THEN charx% = 303
IF chary% < 0 THEN chary% = 0
IF chary% > 183 THEN chary% = 183
at firrst i had this, its for a 8x8 originally
Code:
IF charx% < 0 THEN charx% = 0
IF charx% > 311 THEN charx% = 319
IF chary% < 0 THEN chary% = 0
IF chary% > 191 THEN chary% = 199

then i tried to chng it for a 16x16 so i went like this
Code:
IF charx% < 0 THEN charx% = 0
IF charx% > 303 THEN charx% = 319
IF chary% < 0 THEN chary% = 0
IF chary% > 183 THEN chary% = 199

and finally i saw wat i was doing wrong which was changin wat to set the value to
Code:
IF charx% < 0 THEN charx% = 0
IF charx% > 311 THEN charx% = [u]303[/u]
IF chary% < 0 THEN chary% = 0
IF chary% > 183 THEN chary% = [u]183[/u]

which is wat u said, i hate those simple mistakes that u hav a hard time noticing but others see easily, thnx