|
Post by Syniphas on Oct 18, 2008 3:22:25 GMT -5
While making a basic movement engine for my game, I ran into the following problem:
if joypad(0).0 = 1 then heady-- endif if joypad(0).1 = 1 then heady++ endif if joypad(0).2 = 1 then headx-- endif if joypad(0).3 = 1 then headx++ endif drawblock 356,headx,heady,4 sleep 2 drawblock 372,headx,heady,4
Theoretically, the code is fine. But, upon running it, the object in question won't move up, only on the 3 other directions. Any ideas?
|
|
|
Post by Mairtrus on Oct 18, 2008 10:48:21 GMT -5
From version 1.00 (I think?? ), the argunerics do not return the values 0 and 1, they now return the values 0 and "any other value". The correct way to make this is: if joypad(0).0 then heady-- endif if joypad(0).1 then heady++ endif if joypad(0).2 then headx-- endif if joypad(0).3 then headx++ endif drawblock 356,headx,heady,4 sleep 2 drawblock 372,headx,heady,4 In this way, by not including a comparision into the "if" is compared to "non-zero." This: if joypad(0).0 then and this: if joypad(0).0 <> 0 then are exactly the same.
|
|
|
Post by Syniphas on Oct 18, 2008 10:51:56 GMT -5
Indeed, it works now. Thanks!
|
|
|
Post by Syniphas on Oct 18, 2008 14:23:53 GMT -5
Okay, here's another question: Is there how to make pixel-per-pixel movement, not every 8 pixels?
|
|
|
Post by ScroGer on Oct 18, 2008 16:28:56 GMT -5
|
|
|
Post by Mairtrus on Oct 18, 2008 19:49:42 GMT -5
Your guide need to be Sticky, ScroGer. Is the unique way that the people will learn to manage correctly the graphical features of BEX.
|
|
oompa loompa
I AM THE GOVERNATOR
"Git 'Er Dun!"
Posts: 1,301
|
Post by oompa loompa on Oct 20, 2008 17:36:54 GMT -5
Your guide need to be Sticky, ScroGer. Is the unique way that the people will learn to manage correctly the graphical features of BEX. stickified it shall be
|
|
|
Post by Syniphas on Oct 22, 2008 22:30:57 GMT -5
While making a position map, I ran into the problem that negative values (y is 0, running y--) makes them immediately 65535 (maximum integr value). Is there how to actually use negative numbers?
|
|
|
Post by Mairtrus on Oct 23, 2008 10:08:15 GMT -5
You can set a new zero (for example 32768 or $8000) and make separated parser routines for each negative or positive value. Also, remember that the Genesis maths are "cyclical": Put a tile in the column 0 or in the column 64 are the same; or put a sprite in the position 0 or 512 are the same.
|
|
|
Post by ScroGer on Oct 23, 2008 20:40:52 GMT -5
Your guide need to be Sticky, ScroGer. Is the unique way that the people will learn to manage correctly the graphical features of BEX. stickified it shall be O snap thats cool ;D ;D ;D I'll try and add more too!!!!!!!!!!!!!
|
|