Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spinner Game Demo
#11
(10-04-2024, 03:54 AM)JRace Wrote: Gyruss!

An old coin-op game that has a similar looking ship moving in the same way.  That "where have I played this before?" feeling bugged me.  As a proud old arcade regular, I had to figure it out.

I knew it began with a G!


Quote:I just renamed all the files to lower case for any other Linux user. Hey, I wonder if a command like that exists in Windows?
Not such a simple way, unless Win11 added features to RENAME.  There are many free bulk file renaming utilities, and many file managers such as Free Commander can do bulk renaming with case changes.


Here is a way to change uppercase to lowercase (but not lower-to-upper) from the Windows command line, without additional tools:
Code: (Select All)
for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")
if typed directly into the command prompt, or
Code: (Select All)
for /f "Tokens=*" %%f in ('dir /l/b/a-d') do (rename "%%f" "%%f")
if used in a batch script.


It can also be done in PowersHell: 
Code: (Select All)
dir MYDIR -r | % { if ($_.Name -cne $_.Name.ToLower()) { ren $_.FullName $_.Name.ToLower() } }
(replace MYDIR with the name of the directory that contains the offending files, or leave it out to operate on the current directory.  This method will recurse into subdirectories as well.)


Cool ship you've got there, Terry!
Yes, Gyruss! I completely forgot about that game.

I used to be the DOS batch script king back in the day. Thank you for the scripts, I'm so behind the times now.

I can't take credit for the ship. I found it on the Internet probably 10 years ago. I included the original image below. I modified the image for the game to get rid of the lighting effect in the original.


Attached Files Image(s)
   
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#12
Here's a video of Gyruss.

New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#13
@TerryRitchie, I downloaded and tried running your demo, but it just sits there on my Mac. The ship briefly spins to a stop at 11 o'clock and won't budge no matter what I do with the mouse. I can fire a bullet every eight seconds or so. Very odd. What's a guy to do?
Reply
#14
(10-04-2024, 05:48 PM)NakedApe Wrote: @TerryRitchie, I downloaded and tried running your demo, but it just sits there on my Mac. The ship briefly spins to a stop at 11 o'clock and won't budge no matter what I do with the mouse. I can fire a bullet every eight seconds or so. Very odd. What's a guy to do?
Does the basic spinner code at this post work for you?

https://qb64phoenix.com/forum/showthread.php?tid=3085
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#15
Nope, it just sits there with the little circle in the middle.   Huh
Reply
#16
(10-04-2024, 06:52 PM)NakedApe Wrote: Nope, it just sits there with the little circle in the middle.   Huh
The code uses _MOUSEMOVE. I know this command has caused issues with Macs in the past but I thought those were behind us. Have you upgraded to the latest version of QB64pe?

Try moving this line:

_MOUSEMOVE CENTERX, CENTERY

to just under the _DISPLAY statement in the loop to see if things change.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#17
Ahh, of course, I should've noticed the _MouseMove in Spinner.bas. _MouseMove doesn't really work well on MacOS. There's a GLUT issue that's pretty tough to resolve according to the devs. Right now the command causes a .25 second delay every time it's called. That would explain nothing moving onscreen since it's in the loop. If I disable that line and run the program _FullScreen (so the pointer stays fully onscreen), it works just fine. 

The program does have a nice arcade feel to it!  Smile
Reply
#18
Also Terry I was checking out your library and noticed a Vec2Deg function that was longer than the one I use. Is this simpler version as useful?

Code: (Select All)
Dim As Single Vx, Vy, angle

start:
Cls
Print "Type in vectors, Vx, Vy"
Input Vx: Input Vy
angle = Vec2Deg(Vx, Vy)
Print: Print "The answer is "; Using "###.###"; angle;: Print " degrees."
If Vx = 0 Or Vy = 0 Then System
Sleep
GoTo start:

Function Vec2Deg (Vx As Single, Vy As Single) '
    ' ** Turns vector pairs into degrees  **
    Dim As Double radian
    Dim As Single degrees

    radian = _Atan2(Vx, Vy) '
    degrees = _R2D(radian) '
    If degrees < 0 Then degrees = 360 + degrees '
    Vec2Deg = degrees '
End Function
Reply
#19
(10-04-2024, 10:04 PM)NakedApe Wrote: Also Terry I was checking out your library and noticed a Vec2Deg function that was longer than the one I use. Is this simpler version as useful?

Code: (Select All)
Dim As Single Vx, Vy, angle

start:
Cls
Print "Type in vectors, Vx, Vy"
Input Vx: Input Vy
angle = Vec2Deg(Vx, Vy)
Print: Print "The answer is "; Using "###.###"; angle;: Print " degrees."
If Vx = 0 Or Vy = 0 Then System
Sleep
GoTo start:

Function Vec2Deg (Vx As Single, Vy As Single) '
    ' ** Turns vector pairs into degrees  **
    Dim As Double radian
    Dim As Single degrees

    radian = _Atan2(Vx, Vy) '
    degrees = _R2D(radian) '
    If degrees < 0 Then degrees = 360 + degrees '
    Vec2Deg = degrees '
End Function

If all you need is integer values, you can also use something really simple such as this:


Code: (Select All)
Dim As Single Vx, Vy, angle
For Vx = -5 To 5
For Vy = -5 To 5
angle = Vec2Deg(Vx, Vy)
Print Vec2Deg(Vx, Vy), V2D(Vx, Vy)
Next
Next

Function Vec2Deg (Vx As Single, Vy As Single) '
' ** Turns vector pairs into degrees **
Dim As Double radian
Dim As Single degrees

radian = _Atan2(Vx, Vy) '
degrees = _R2D(radian) '
If degrees < 0 Then degrees = 360 + degrees '
Vec2Deg = degrees '
End Function

Function V2D (Vx As Single, Vy As Single) '
' ** Turns vector pairs into degrees **
V2D = (360## + _R2D(_Atan2(Vx, Vy))) Mod 360## '
End Function

No IFs to process. Just one simple line of math to keep your angle between 0 and 360. If you need decimal precision (44.587 degrees instead of 45 degrees, for example), this wouldn't work. But if you want something speedy and *close enough* is close enough, it might serve you better in many use cases.
Reply
#20
(10-04-2024, 10:04 PM)NakedApe Wrote: Also Terry I was checking out your library and noticed a Vec2Deg function that was longer than the one I use. Is this simpler version as useful?

Code: (Select All)
Dim As Single Vx, Vy, angle

start:
Cls
Print "Type in vectors, Vx, Vy"
Input Vx: Input Vy
angle = Vec2Deg(Vx, Vy)
Print: Print "The answer is "; Using "###.###"; angle;: Print " degrees."
If Vx = 0 Or Vy = 0 Then System
Sleep
GoTo start:

Function Vec2Deg (Vx As Single, Vy As Single) '
    ' ** Turns vector pairs into degrees  **
    Dim As Double radian
    Dim As Single degrees

    radian = _Atan2(Vx, Vy) '
    degrees = _R2D(radian) '
    If degrees < 0 Then degrees = 360 + degrees '
    Vec2Deg = degrees '
End Function
Yes, yours and Steve's routines are much better. Thank you for pointing that out and sharing the code.

That goes for everyone, if you notice that any of my libraries can be enhanced/improved upon by all means let me know. Many of the small libraries I post with code here make up the larger game library I'm working on. The better the routines the better the library will be.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply




Users browsing this thread: 5 Guest(s)