Jump to content
IGNORED

SFX Question


atari2600land

Recommended Posts

Suppose I got this code (I snipped it from a game I'm working on). When a{2}=1 (or when the player falls), f automatically goes to 7 instead of being 1 like it should be. Why?

 

 
if a{1} then t=t+1 : y=y-1 : n=n-1 : b=3 : f=f-1
if a{1} && f<2 then f=1
if t=40 then a{1}=0 : a{2}=1

if a{2} then y=y+1 : n=n+1 : b=3 : f=f+1
if a{2} && f>7 then f=7

Edited by atari2600land
Link to comment
Share on other sites

Suppose I got this code (I snipped it from a game I'm working on). When a{2}=1 (or when the player falls), f automatically goes to 7 instead of being 1 like it should be. Why?

 

 
if a{1} then t=t+1 : y=y-1 : n=n-1 : b=3 : f=f-1
if a{1} && f<2 then f=1
if t=40 then a{1}=0 : a{2}=1

if a{2} then y=y+1 : n=n+1 : b=3 : f=f+1
if a{2} && f>7 then f=7

If this code is part of a loop, then whenever a{2} is 1, the next-to-last line will keep incrementing f each time through the loop, and the last line will prevent f from exceeding 7-- so after you go through the loop a few times, f will be 7.

 

Michael

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...