Page 5 of 6

Re: Old Skool Effects & Other Stuff

Posted: Sat Nov 09, 2024 6:37 pm
by JHPJHP
Hi All,

Your comments were very much appreciated.
• It's great to hear what inspires people to create the things they do; most of us have similar stories... community.
• And the things we did to our coworkers back in the day that only a programmer can understand; faking a BSOD was one of my favorites.
• It's also nice to know that others share the same questions and concerns; it's weird, but sometimes I feel more isolated in a community.
• Even when this type of thread is not for everyone, some forum members will still take the time to post a thank you; I'm grateful.

------------------------------

To everyone who posted their appreciation:
• I never planned on including the following, but since I'm here and the theme is Old Skool.

Download: Invading Space Aliens
➤ Left | Right Arrow Keys: Move Player
➤ Spacebar: Shoot Aliens / Unpause Game / Skip Intro
➤ Enter Key: Pause Game / Unpause Game

➤ B Key: Switch Background Display (various landscapes, stars, no background)
➤ H Key: Open Help Window
➤ V Key: Adjust Volume

➤ Ctrl + Left | Right Arrow Keys: Enter PLAY LEVEL mode (practice levels between 1 - 11)
➤ Ctrl + Enter: Start a New Game / Exit PLAY LEVEL mode

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

• For every 10000 points, if a player position is available, you earn a free player.
• The game will auto-pause if the window loses focus.

Image

Re: Old Skool Effects & Other Stuff

Posted: Sat Nov 09, 2024 10:42 pm
by Fangbeast
Yay!!! My wife and I used to play that centuries ago, me more than here. But, we both loved something so simple.

Re: Old Skool Effects & Other Stuff

Posted: Sat Nov 09, 2024 11:16 pm
by idle
That brings back memories.

Re: Old Skool Effects & Other Stuff

Posted: Sun Nov 10, 2024 12:03 am
by ChrisR
Me too, lots of good memories between 2 games of table soccer.

Re: Old Skool Effects & Other Stuff

Posted: Sun Nov 10, 2024 11:03 am
by SPH
Atari 2600 rulez

Re: Old Skool Effects & Other Stuff

Posted: Sun Nov 10, 2024 7:49 pm
by JHPJHP
Hi All,

Thank you. I too am nostalgic for the good old days.

------------------------------

The following game was more fun to program then it is to play, but provides some interesting code:
• I never planned on including the following, but since I'm here and the theme is Old Skool.

Download: Death Star vs Asteroids
➤ Left | Right Arrow Keys: Rotate Death Star
➤ Spacebar: Shoot Asteroids / Unpause Game / Skip Intro
➤ Enter Key: Pause Game / Unpause Game / Start New Game (only after Health = 000)

➤ H Key: Open Help Window
➤ V Key: Adjust Volume

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

• For every 5000 points 5 health points will be added to the Death Star.
• The game will auto-pause if the window loses focus.

Image

Re: Old Skool Effects & Other Stuff

Posted: Mon Nov 11, 2024 12:24 am
by BarryG
> Invading Space Aliens
> Death Star vs Asteroids

What the? Great jobs! :) "Invading Space Aliens" is better than the original arcade one because it shoots and moves faster - I always hated the slow speed of the original. I bought you a coffee. ;)

Re: Old Skool Effects & Other Stuff

Posted: Mon Nov 11, 2024 5:54 pm
by JHPJHP
Hi BarryG,

Thank you for the coffee. I'm glad you liked "Invading Space Aliens".

I remember when I began coding, it had been decades since I played the game, and I didn't watch any videos to help with accuracy. When I was mostly done programming, I compared it with videos from the 80s, and I could see that I was fairly accurate in some areas and way off in others.

---------------------------------

Hi All,

This next post is less Old Skool (8 years), but still fits within the graphics theme.

Download: Fluid Simulation
• 1:1 conversion from the original C++ code.
• In addition to OpenGL, the download also includes a sprite example.

Converted from the following script: https://github.com/983/Fluid-Simulation.

Note: The 64-bit C compiler was used to improve performance.

Image

Re: Old Skool Effects & Other Stuff

Posted: Mon Nov 11, 2024 7:09 pm
by threedslider
Hi @JHPJHP :)

Nice work for your all you did and especially for fluid simulation that I have done in the past too with pjay (he has done great job then :P ! ) :shock:

Your fluid simulation is more fast than mine :shock:

Keep it up and I am looking forward to your stuffs !

Happy coding !

Re: Old Skool Effects & Other Stuff

Posted: Tue Nov 12, 2024 5:59 pm
by JHPJHP
Hi threedslider,

Thank you for posting, you are most welcome.

It's great you were able to work with another forum member and find a working solution. I find small (but technical) projects like this a great way to ignite the synapsis. When I work on the same thing too long, I cannot see the forest through the trees, so Fluid Simulation was a nice distraction.

----------------------------------

Hi All,

This will be my final contribution to this thread.

Download: Lode's Of Fun
• Lode Vandevenne: Lode's Homepage
• References have been included at the top of each example to give credit where credit is due.

The included 8 examples demonstrate some cool effects:
• If there are any additional features they will be listed in the Title Bar.
• Some of the examples, where applicable, include the Maximize Window Button.

Julia Effect & Mandelbrot Effect:
• Updating the code to increase window size will improve pixelation but slow down animations.
• While the Maximize Window Button won't improve pixelation it will improve the overall experience.
1. Maximize the window.
2. Press the F1 key to show Control Options.
3. Press the F4 / F5 keys to run the zoom-out / zoom-in animations.

Image

Image

Re: Old Skool Effects & Other Stuff

Posted: Wed Nov 13, 2024 6:46 pm
by JHPJHP
Hi All,

I have one more bonus example; originally written by one of our own: Patrice Terrier
• References have been included to give credit where credit is due.

Download: Animated Goldfish
• The nice thing about this example, it was created using gdiPlus.
• The goldfish swims over the desktop while the user still has full access to the computer.

OPTIONS:
➤ Use the mouse to position the goldfish.
➤ Up Arrow Key directs the goldfish at an up angle.
➤ Down Arrow Key directs the goldfish at a down angle.
➤ Spacebar directs the goldfish to a relatively straight line.
➤ Esc Key fades (closes) the goldfish when the little guy has focus.

Image

Re: Old Skool Effects & Other Stuff

Posted: Wed Nov 13, 2024 9:25 pm
by idle
nice works well thanks

Re: Old Skool Effects & Other Stuff

Posted: Wed Nov 13, 2024 9:45 pm
by SPH
Thank you JHP for that codes. It's beautiful ! (and smart) :wink:

Re: Old Skool Effects & Other Stuff

Posted: Thu Nov 14, 2024 2:27 am
by BarryG
> Animated Goldfish

Cute. I like it. :)

Re: Old Skool Effects & Other Stuff

Posted: Thu Nov 14, 2024 12:14 pm
by Mr.L
Thanks a lot for this collection of beautiful graphics effects! I really enjoyed all of them!
The rotating gears are one of my favorites, so I decided to give it a personal touch...

Code: Select all

EnableExplicit

InitSprite()

Enumeration
	#MainWindow
EndEnumeration

#GEAR_TEETH_SCALE = 6           ; Scale factor for converting teeth count to radius
#GEAR_HUB_RATIO = 4				; Ratio of gear radius to hub radius
#TOOTH_AMPLITUDE = 15			; Amplitude of gear teeth
#GEAR_PADDING = 12				; Additional padding around gear
#ANGLE_INCREMENT = 0.015		; Angle increment for tooth generation

Structure Gear
	sprite.i                     ; Gear sprite
	positionX.l					 ; X position on canvas
	positionY.l					 ; Y position on canvas
	radius.l					 ; Radius including teeth
	rotationSpeed.f				 ; Speed of rotation (proportional to the teeth count)
EndStructure

Global NewList Gears.Gear()

Macro LimitToothDepth(angle)
	Max(Min(Sin(angle), 0.7), -0.6)
EndMacro

Procedure.f Max(a.f, b.f) : If a > b : ProcedureReturn a : EndIf : ProcedureReturn b : EndProcedure
Procedure.f Min(a.f, b.f) : If a < b : ProcedureReturn a : EndIf : ProcedureReturn b : EndProcedure

Procedure CreateGear(centerX.l, centerY.l, teethCount.l, index.l, direction.l, gearColor.l)
	Protected *gear.Gear = AddElement(Gears())
	If *gear
		Protected.f angleStep, gearRadius, hubRadius, phase, radius
		Protected.f x, y
		
		gearRadius = (teethCount * #GEAR_TEETH_SCALE) * DesktopResolutionX()
		hubRadius = gearRadius * 0.5
		
		centerX * DesktopResolutionX()
		centerY * DesktopResolutionY()
		
		*gear\positionX = centerX - gearRadius
		*gear\positionY = centerY - gearRadius
		*gear\rotationSpeed = direction / teethCount
		*gear\radius = gearRadius + #GEAR_PADDING
		
		centerX = gearRadius + #GEAR_PADDING
		centerY = gearRadius + #GEAR_PADDING
		Protected image = CreateImage(#PB_Any, *gear\radius * 2, *gear\radius * 2, 32, #PB_Image_Transparent)
		
		If StartVectorDrawing(ImageVectorOutput(image))
			angleStep = 0
			Repeat
				radius = gearRadius + #TOOTH_AMPLITUDE * LimitToothDepth(teethCount * angleStep)
				x = centerX + radius * Cos(angleStep)
				y = centerY + (radius * Sin(angleStep) * direction)
				If angleStep = 0 : MovePathCursor(x, y) : EndIf
				AddPathLine(x, y)
				angleStep + #ANGLE_INCREMENT
			Until angleStep >= (2 * #PI) + #ANGLE_INCREMENT
			
			AddPathCircle(centerX, centerY, hubRadius)
			AddPathCircle(centerX, centerY, hubRadius * 0.75)
			VectorSourceColor(gearColor)
			FillPath(#PB_Path_Preserve)
			VectorSourceColor(RGBA(0, 0, 0, 64))
			StrokePath(6, #PB_Path_Preserve)
			VectorSourceColor(RGBA(0, 0, 0, 255))
			StrokePath(3)
			
			StopVectorDrawing()
			
			*gear\sprite = CreateSprite(#PB_Any, ImageWidth(image), ImageHeight(image), #PB_Sprite_AlphaBlending)
			If StartDrawing(SpriteOutput(*gear\sprite))
				DrawAlphaImage(ImageID(image), 0, 0)
				StopDrawing()
			EndIf
			FreeImage(image)
		EndIf
	EndIf
EndProcedure
DisableExplicit

InitSprite()
InitKeyboard()

screenWidth = 800
screenHeight = 600
windowFlags = #PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered

If OpenWindow(#MainWindow, 0, 0, screenWidth, screenHeight, "Gear Animation", windowFlags)
	If OpenWindowedScreen(WindowID(#MainWindow), 0, 0, DesktopScaledX(screenWidth), DesktopScaledY(screenHeight))
		CreateGear(485, 220, 30, 1, -1, RGBA(205, 127,  50, 255))
		CreateGear(215, 240, 15, 2,  1, RGBA(176, 196, 222, 255))
		CreateGear(234, 372,  7, 4, -1, RGBA(184, 115,  51, 255))
		CreateGear(83,   74, 20, 6, -1, RGBA(192, 192, 192, 255))
		CreateGear(746, 414, 24, 3,  1, RGBA(205, 127,  50, 255))
		CreateGear(-10, 518, 40, 5,  1, RGBA(170, 169, 173, 255))
		CreateGear(705,  93, 12, 7,  1, RGBA(230, 232, 250, 255))
		
		Repeat
			Repeat
				event = WindowEvent()
				If event = #PB_Event_CloseWindow
					Break 2
				EndIf
			Until Not event
			
			currentAngle = ElapsedMilliseconds()
			
			ClearScreen(RGB(128, 128, 128))
			ForEach Gears()
				With Gears()
					RotateSprite(\sprite, currentAngle * \rotationSpeed, #PB_Absolute)
					DisplayTransparentSprite(\sprite, \positionX + 15, \positionY + 15, 64, 0) ; shadow
					DisplayTransparentSprite(\sprite, \positionX, \positionY)
				EndWith
			Next
			FlipBuffers()
		ForEver
	EndIf
EndIf