Jump to content
Gemintronic

Multiple statements & bitwise operations don't mix

Recommended Posts

I'm repeatedly stumbling on a phenomenon where bitwise operations fail to register properly if on a line with multiple statements.

 

So, THIS wont work:

( note bdir is a define "def bdir=moreattr{0}" )

 

movebullet
if ballx = 0 then ballx = player1x : bally = (player1y+4) : if player0x > player1x then bdir = 1 else bdir = 0
if bdir then ballx = ballx + 1 else ballx = ballx - 1
goto after_rise

 

but, THIS does:

 

movebullet
if ballx = 0 then goto setballdir
after_setballdir
if bdir then ballx = ballx + 1 else ballx = ballx - 1
goto after_rise

setballdir
ballx = player1x : bally = (player1y+4)
if player0x > player1x then bdir = 1 else bdir = 0
goto after_setballdir

Share this post


Link to post
Share on other sites

Have you tried your first version without using def? You might want to see if there is a difference.

Share this post


Link to post
Share on other sites

Have you tried your first version without using def? You might want to see if there is a difference.

 

Thanks R.T. I might try that. It would REALLY suck if I had to not use defines, though. "attribute{4}" tells me nothing whereas

"def ismariobig=attribute{4}" tells me everything.

Share this post


Link to post
Share on other sites

Thanks R.T. I might try that. It would REALLY suck if I had to not use defines, though. "attribute{4}" tells me nothing whereas

"def ismariobig=attribute{4}" tells me everything.

 

Yeah, it would really help to know if it's bit operations or def.

 

 

I had all kinds of random troubles with def, so I quit using it. When using bit operations, I do stuff like this:

 

  dim _Bit0_Reset_Restrainer = t
  dim _Bit1_FireB_Restrainer = t
  dim _Bit2_Direction_Changed = t

 

 

Here's a tiny line of code showing one in use:

 

   if !joy0fire then _Bit1_FireB_Restrainer{1} = 0 : goto __Skip_Fire

 

Having the bit number in the name tells me what number to use and the rest of the name is descriptive, so I don't even miss def.

  • Like 1

Share this post


Link to post
Share on other sites

this statement

movebullet
if ballx = 0 then ballx = player1x : bally = (player1y+4) : if player0x > player1x then bdir = 1 else bdir = 0

 

behaves kinda like the else clause belongs to both

if staments

 

movebullet_
if ballx = 0 then ballx = player1x : bally = (player1y+4) : if player0x > player1x then bdir = 1 : goto skip
bdir = 0
skip

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...