QB64 Phoenix Edition
Asteroid Shower - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Asteroid Shower (/showthread.php?tid=1317)

Pages: 1 2


RE: Asteroid Shower - SMcNeill - 03-17-2023

For any IF statement, it's always implied <> 0 for a truth expression.

IF holdspace THEN ...  

The above is the exact same as if you had typed IF holdspace <>  0 THEN ...

Code: (Select All)
IF _KEYDOWN(32) = 0 AND holdspace THEN holdspace = 0

The above *should be* the same as typing IF _KEYDOWN(32) = 0 AND holdspace <> 0 THEN holdspace = 0.

The reason I say *should* is that sometimes those types of statements can get resolved in an unexpected order such as IF _KEYDOWN(32) = (0 AND holdspace) THEN....   If I was writing that line of code, I think I'd either write it as:

IF NOT _KEYDOWN(32) AND holdspace THEN holdspace = 0

Or, perhaps as:

IF (_KEYDOWN(32) = 0) AND (holdspace <> 0) THEN holdspace = 0

I'm a strong believer in taking the ambiguity out of any order of operations.  As written, I'd personally question if it's doing exactly what I'd be expecting it to do for me.  Wink


RE: Asteroid Shower - aurel - 03-17-2023

Quote:The above *should be* the same as typing IF _KEYDOWN(32) = 0 AND holdspace <> 0 THEN holdspace = 0.

Thanks Steve ..i was asking just about that , because some other dialects use as -1 as TRUE
or some use 1 or as you said everything that not NULL as TRUE
Wink


RE: Asteroid Shower - TempodiBasic - 03-23-2023

@mnrvovrfc
It is fun!
Why do you not use sounds?

Nevertheless it works better on my notebook adding at line 83 (before the last LOOP) this code
Code: (Select All)
    _Limit 10

Is it normal that when I gain the rigth edge, the astroship appears again on the left edge?


RE: Asteroid Shower - bplus - 03-23-2023

2 If holdspace <> 0 then make holdspace = 0


RE: Asteroid Shower - hsiangch_ong - 05-25-2024

very addictive game!

it is like car/bike game with simple scrolling trick. but scroll downward looks better in this game. i have tried to write a game like this in basica. but INKEY$ keyboard buffer problem was bad. i wish there was way to limit one keypress at a time. i know qb64 has functions for key press state but it could also be problematic. because cannot use _DELAY or _LIMIT, must be more clever enough about it. i did try to program with KEY ON and the like but i don't like arrow keys and function keys all the time.

working with threads is a pain. but it's the only way to get good response for user input and game flow.


RE: Asteroid Shower - kn0ne - 07-16-2024

Some nice old school fun! Thanks!!