Author Topic: Star Backgound  (Read 1795 times)

Re: Star Backgound
« Reply #15 on: June 11, 2018, 06:34:43 AM »
I love space backgrounds and I think this makes a perfect desktop background image.

Thank you johnno56 for sharing this image.
« Last Edit: June 16, 2018, 02:08:19 PM by odin »

Offline johnno56

  • Live long and prosper.
Re: Star Backgound
« Reply #16 on: June 11, 2018, 07:56:02 AM »
Not a problem. It's an image I through together using Gimp. Enjoy.

J
Logic is the beginning of wisdom.

Re: Star Backgound
« Reply #17 on: June 16, 2018, 01:25:44 PM »
I don't know why I am doing this, but oh well.

Space the Final Frontier ....
Famous words from Star Trek created by Gene Roddenberry.

In honor of Star Trek (and johnno56 for his stars image), here is a GREAT animation for your enjoyment.

Please download the images archive which includes all images for this program.
All images are in the public domain and free to use.  See code for location of the images.

Attachment: http://qb64.org/binbin/79DC/Space.zip

Code: [Select]
_TITLE "Space the Final Frontier"

RANDOMIZE TIMER

DIM Touch AS STRING

' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 800
sHeight = 600

SCREEN _NEWIMAGE(sWidth, sHeight, 32)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED starBack AS LONG
DIM SHARED Starship AS LONG

' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
starBack = _LOADIMAGE(".\images\Stars.png")
_PUTIMAGE (0, 0), starBack

' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
Starship = _LOADIMAGE(".\images\Starship.png")
_CLEARCOLOR _RGB(0, 0, 0), Starship

' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
DIM SHARED warpSpeed AS INTEGER
warpSpeed = 2

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED shipX AS INTEGER
DIM SHARED shipY AS INTEGER
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
TYPE Celestial
  ' Location
  x AS INTEGER
  y AS INTEGER

  ' Size
  w AS INTEGER
  h AS INTEGER

  ' Rotation
  r AS INTEGER

  show AS INTEGER

  image AS LONG
END TYPE

' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
DIM SHARED Stars(2) AS Celestial

Stars(1).x = 0
Stars(2).x = 800

Stars(1).image = _NEWIMAGE(800, 600, 32)
_PUTIMAGE (0, 0), starBack, Stars(1).image

Stars(2).image = _NEWIMAGE(800, 600, 32)
Frontier

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."

y = sHeight \ 2 - 8
x = sWidth \ 2 - (LEN(Touch) * 4)
_PRINTSTRING (x, y), Touch

DIM SHARED Planet(40) AS Celestial

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR p = 1 TO 40
  ' Planets:
  ' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
  Planet(p).image = _LOADIMAGE(".\images\Planet" + RIGHT$("0" + LTRIM$(STR$(p)), 2) + ".png")
  _CLEARCOLOR _RGB(0, 0, 0), Planet(p).image

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Get the Width and Height of the planet
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Planet(p).w = _WIDTH(Planet(p).image)
  Planet(p).h = _HEIGHT(Planet(p).image)
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
FOR x = -400 TO shipX STEP 10
  _PUTIMAGE (0, 0), starBack
  _PUTIMAGE (x, shipY), Starship

  _DISPLAY
  _LIMIT 30
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
WHILE Touch <> CHR$(27)
  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Places the stars Backgrounds
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
  _PUTIMAGE (Stars(1).x, 0), Stars(1).image
  _PUTIMAGE (Stars(2).x, 0), Stars(2).image

  ' \/\/\/\/\/\/\/\/\/\/
  ' Places the Starship
  ' /\/\/\/\/\/\/\/\/\/\
  _PUTIMAGE (shipX, shipY), Starship

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Checks to see if a key is pressed
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Touch = INKEY$
  IF Touch <> "" THEN
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Keys 0-9 changes the warpspeed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF ASC(Touch) > 47 AND ASC(Touch) < 58 THEN warpSpeed = VAL(Touch)
  END IF

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Have the background shift left by warpspeed
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Stars(1).x = Stars(1).x - warpSpeed
  Stars(2).x = Stars(2).x - warpSpeed

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' When the background reaches the end reset background
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  IF Stars(2).x < 0 THEN
    Stars(1).x = 0
    Stars(2).x = 800

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Put the second image on the first to keep the animation proper
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    _PUTIMAGE (0, 0), Stars(2).image, Stars(1).image

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Add Planets to the animation
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Frontier
  END IF

  _DISPLAY
  _LIMIT 120
WEND
END

SUB Frontier
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Reset the background and rotate to make things different
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
SELECT CASE INT(4 * RND)
  CASE 0: _PUTIMAGE (0, 0), starBack, Stars(2).image
  CASE 1: _PUTIMAGE (799, 0)-(0, 599), starBack, Stars(2).image
  CASE 2: _PUTIMAGE (0, 599)-(799, 0), starBack, Stars(2).image
  CASE 3: _PUTIMAGE (799, 599)-(0, 0), starBack, Stars(2).image
END SELECT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Choose a Planet to display
' /\/\/\/\/\/\/\/\/\/\/\/\/\
p = INT(50 * RND)

IF p > 0 AND p < 41 THEN
  ' \/\/\/\/\/\/\/\/\/\/\/\/
  ' Get the Width and Height
  ' /\/\/\/\/\/\/\/\/\/\/\/\
  w = Planet(p).w
  h = Planet(p).h

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Make sure planet isn't going off the screen
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  x1 = INT((sWidth - w) * RND): x2 = x1 + w
  y1 = INT((sHeight - h) * RND): y2 = y1 + h

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Rotate the planet to try and make it look different
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Planet(p).r = Planet(p).r + 1
  IF Planet(p).r = 4 THEN Planet(p).r = 0

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Place the planet on the background rotated
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  SELECT CASE Planet(p).r
    CASE 0: _PUTIMAGE (x1, y1), Planet(p).image, Stars(2).image
    CASE 1: _PUTIMAGE (x2, y1)-(x1, y2), Planet(p).image, Stars(2).image
    CASE 2: _PUTIMAGE (x1, y2)-(x2, y1), Planet(p).image, Stars(2).image
    CASE 3: _PUTIMAGE (x2, y2)-(x1, y1), Planet(p).image, Stars(2).image
  END SELECT
END IF
END SUB

Offline Ashish

  • The joy of coding is endless.
Re: Star Backgound
« Reply #18 on: June 16, 2018, 01:29:57 PM »
+CodeHunter
Its cool to see spaceship running!
if (Me.success) {Me.improve()} else {Me.tryAgain()}


aKFrameWork - http://bit.ly/aKFrameWork
Menu System - http://bit.ly/guiMenuBar
p5.js in QB64 - http://bit.ly/p5jsbas

@KingOfCoders

Re: Star Backgound
« Reply #19 on: June 16, 2018, 02:02:01 PM »
Nice one Code Hunter! Just like coming home again!

BTW, weren't you already a member here??? eg post in this thread June 11???
« Last Edit: June 16, 2018, 02:05:29 PM by bplus »
B = B + ...
QB64 x 64 v1.2 2018 0228/86 git b30af92
QB64 v1.2 20180228/86 git 6fde149
QB64 v1.2 [dev build]_d84bb00

Offline johnno56

  • Live long and prosper.
Re: Star Backgound
« Reply #20 on: June 16, 2018, 07:06:18 PM »
Just a couple of things...

Firsly, VERY cool demo...

Can I assume correctly that QB64's default transparency colour is black? If so, a couple of the planets, have transparent 'patches'... If you like I can fix that... and one of the 'Mars' images is upside down... I can fix that too if you wish... I have limited time today (Sunday), as we will be out most of the day, but I can make the changes later this afternoon if that's ok?

Other than these few 'cosmetic' effects the demo ran very smoothly... I like it!!!

J

ps: Never mind about Mars. Ran the demo longer and notice the image was 'flipped'....
« Last Edit: June 16, 2018, 07:10:24 PM by johnno56 »
Logic is the beginning of wisdom.

Re: Star Backgound
« Reply #21 on: June 16, 2018, 08:36:58 PM »
Just a couple of things...

Firsly, VERY cool demo...

Can I assume correctly that QB64's default transparency colour is black? If so, a couple of the planets, have transparent 'patches'... If you like I can fix that... and one of the 'Mars' images is upside down... I can fix that too if you wish... I have limited time today (Sunday), as we will be out most of the day, but I can make the changes later this afternoon if that's ok?

Other than these few 'cosmetic' effects the demo ran very smoothly... I like it!!!

J

ps: Never mind about Mars. Ran the demo longer and notice the image was 'flipped'....

Thank you.  I am glad you enjoyed it.  It was a migraine to get working but once I had it working it came out great.

Yes default transparency is black.

Although I downloaded all the images off the website provided, some were larger than the screen height or width so those were converted to half size.  I believe that is what caused the weird 'patches' in the effects.  With my bad eyes they looked really cool so I didn't bother to try and repair them.  If you wish to repair any feel free and let me know.

The Starship was also shrank half to not take up the full width of the screen.

I am working on an update that has animated planets.  Might be best to have those patched planets.

If you look at the code the planets are getting flipped around before they are displayed to make it appear to be slightly different planets and not always the same one.  The stars background is also  flipped around for the same reason.
« Last Edit: June 16, 2018, 08:40:12 PM by Code Hunter »

Re: Star Backgound
« Reply #22 on: June 16, 2018, 11:55:26 PM »
Update to the 'Final Frontier'

Original code had keys 0-9 for the speed of the ship. (0 == Pause)
This update adds Up and Down arrow keys to move the ship.  Home key will move the ship back to center.

Also included is random animated planets.

If you don't have the attachment above then please get it.  Don't use the .bas file in that archive.

Here is the code for the update:
Code: [Select]
_TITLE "Space the Final Frontier"

RANDOMIZE TIMER

DIM Touch AS STRING

DIM SHARED frameRate AS INTEGER
DIM SHARED frameCount AS INTEGER

DIM SHARED frameTime AS STRING
frameTime = RIGHT$(TIME$, 2)

' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 800
sHeight = 600

SCREEN _NEWIMAGE(sWidth, sHeight, 32)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED starBack AS LONG
DIM SHARED Starship AS LONG

' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
starBack = _LOADIMAGE(".\images\Stars.png")
_PUTIMAGE (0, 0), starBack

' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
Starship = _LOADIMAGE(".\images\Starship.png")
_CLEARCOLOR _RGB(0, 0, 0), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Used to make sure Starship doesn't go offscreen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
wShip = sWidth - 400
hShip = sHeight - 170

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED shipX AS INTEGER
DIM SHARED shipY AS INTEGER
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85

' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
DIM SHARED warpSpeed AS INTEGER
warpSpeed = 2

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
TYPE Celestial
  ' Location
  x AS INTEGER
  y AS INTEGER

  ' Size
  w AS INTEGER
  h AS INTEGER

  ' Rotation
  c AS INTEGER
  r AS INTEGER

  ' Planet used
  used AS INTEGER

  ' Planet Spins
  spin AS INTEGER

  image AS LONG
END TYPE

' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
DIM SHARED Stars(2) AS Celestial

Stars(1).x = 0
Stars(2).x = 800

Stars(1).image = _NEWIMAGE(800, 600, 32)
_PUTIMAGE (0, 0), starBack, Stars(1).image

Stars(2).image = _NEWIMAGE(800, 600, 32)
Frontier

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."

y = sHeight \ 2 - 8
x = sWidth \ 2 - (LEN(Touch) * 4)
_PRINTSTRING (x, y), Touch

DIM SHARED PlanetView(4) AS INTEGER

DIM SHARED Planet(40) AS Celestial

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR p = 1 TO 40
  ' Planets:
  ' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
  Planet(p).image = _LOADIMAGE(".\images\Planet" + RIGHT$("0" + LTRIM$(STR$(p)), 2) + ".png")
  _CLEARCOLOR _RGB(0, 0, 0), Planet(p).image

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Get the Width and Height of the planet
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Planet(p).w = _WIDTH(Planet(p).image)
  Planet(p).h = _HEIGHT(Planet(p).image)
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
FOR x = -400 TO shipX STEP 10
  _PUTIMAGE (0, 0), starBack
  _PUTIMAGE (x, shipY), Starship

  _DISPLAY
  _LIMIT 30
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
WHILE Touch <> CHR$(27)
  Background

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Checks to see if a key is pressed
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Touch = INKEY$
  IF Touch <> "" THEN
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Keys 0-9 changes the warpspeed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF ASC(Touch) > 47 AND ASC(Touch) < 58 THEN warpSpeed = VAL(Touch)

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Home key centers the Starship
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Touch = CHR$(0) + CHR$(71) THEN
      shipX = sWidth \ 2 - 200
      shipY = sHeight \ 2 - 85
    END IF

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Up and Down Arrow Keys moves the Starship
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Touch = CHR$(0) + CHR$(72) THEN
      shipY = shipY - warpSpeed
      IF shipY < 0 THEN shipY = 0
    END IF

    IF Touch = CHR$(0) + CHR$(80) THEN
      shipY = shipY + warpSpeed
      IF shipY > hShip THEN shipY = hShip
    END IF
  END IF

  Framed

  _DISPLAY
  _LIMIT 60
WEND
END

SUB Background
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Places the stars Backgrounds
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
_PUTIMAGE (Stars(1).x, 0), Stars(1).image
_PUTIMAGE (Stars(2).x, 0), Stars(2).image

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show planet(s)  (if available)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR v = 1 TO 2
  IF PlanetView(v) > 0 THEN
    ViewPlanet PlanetView(v), v
  END IF
NEXT

' \/\/\/\/\/\/\/\/\/
' Show the Starship
' /\/\/\/\/\/\/\/\/\
_PUTIMAGE (shipX, shipY), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Have the background shift left by warpspeed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Stars(1).x = Stars(1).x - warpSpeed
Stars(2).x = Stars(2).x - warpSpeed

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' When the background reaches the end reset background
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
IF Stars(2).x < 0 THEN
  Stars(1).x = 0
  Stars(2).x = 800

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Put the second image on the first to keep the animation proper
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  _PUTIMAGE (0, 0), Stars(2).image, Stars(1).image

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Add Planets to the animation
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Frontier
END IF
END SUB

SUB Frontier
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Reset the background and rotate to make things different
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
SELECT CASE INT(4 * RND)
  CASE 0: _PUTIMAGE (0, 0), starBack, Stars(2).image
  CASE 1: _PUTIMAGE (799, 0)-(0, 599), starBack, Stars(2).image
  CASE 2: _PUTIMAGE (0, 599)-(799, 0), starBack, Stars(2).image
  CASE 3: _PUTIMAGE (799, 599)-(0, 0), starBack, Stars(2).image
END SELECT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Choose a Planet to display
' /\/\/\/\/\/\/\/\/\/\/\/\/\
tag1:
p1 = INT(40 * RND) + 1
IF Planet(p1).used = 1 THEN GOTO tag1

' \/\/\/\/\/\/\/\/\/\/\/\/
' Get the Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
w = Planet(p1).w
h = Planet(p1).h

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Make sure planet isn't going off the screen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
x1 = INT((sWidth - w) * RND)
y1 = INT((sHeight - h) * RND)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Set the Planet as used and save the location
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
IF PlanetView(1) = 0 THEN
  PlanetView(1) = p1
  'ELSE
  '  PlanetView(3) = p1
END IF

Planet(p1).x = 800 + x1
Planet(p1).y = y1

Planet(p1).used = 1
Planet(p1).spin = INT(2 * RND)

IF INT(2 * RND) = 1 THEN
  tag2:
  p2 = INT(40 * RND) + 1
  IF Planet(p2).used = 1 THEN GOTO tag2

  w = Planet(p2).w
  h = Planet(p2).h

  IF p2 <> p1 THEN
    IF w < Planet(p1).w AND h < Planet(p1).h THEN
      x2 = INT((sWidth - w) * RND)
      y2 = INT((sHeight - h) * RND)
    END IF
  END IF

  IF PlanetView(2) = 0 THEN
    PlanetView(2) = p2
    'ELSE
    '  PlanetView(4) = p2
  END IF

  Planet(p2).x = 800 + x2
  Planet(p2).y = y2

  Planet(p2).used = 1
  Planet(p2).spin = INT(2 * RND)
END IF
END SUB

SUB ViewPlanet (p, v)
'w = Planet(p).w

'x = Planet(p).x
'y = Planet(p).y
'_PUTIMAGE (x, y), Planet(p).image, 0

'x = x - 2
'Planet(p).x = x
'_PRINTSTRING (4, sHeight \ 2 - 8), STR$(x) + "    "

'IF x + w < 0 THEN
'  BEEP
'  PlanetView(v) = 0
'  Planet(p).used = 0
'END IF
'EXIT SUB

w = Planet(p).w
h = Planet(p).h

x1 = Planet(p).x
x2 = Planet(p).x + w

y1 = Planet(p).y
y2 = Planet(p).y + h

SELECT CASE Planet(p).r
  CASE 0: _PUTIMAGE (x1, y1), Planet(p).image, 0
  CASE 1: _PUTIMAGE (x2, y1)-(x1, y2), Planet(p).image, 0
  CASE 2: _PUTIMAGE (x1, y2)-(x2, y1), Planet(p).image, 0
  CASE 3: _PUTIMAGE (x2, y2)-(x1, y1), Planet(p).image, 0
END SELECT

IF Planet(p).spin = 1 THEN
  Planet(p).c = Planet(p).c + 1

  IF Planet(p).c = 16 THEN
    Planet(p).c = 0

    Planet(p).r = Planet(p).r + 1
    IF Planet(p).r > 3 THEN Planet(p).r = 0
  END IF
END IF

x1 = x1 - warpSpeed
Planet(p).x = x1

IF x2 < 0 THEN
  PlanetView(v) = 0
  Planet(p).used = 0
END IF
END SUB

SUB Framed
IF RIGHT$(TIME$, 1) = frameTime THEN
  frameCount = frameCount + 1
ELSE
  frameRate = frameCount

  frameCount = 0
  frameTime = RIGHT$(TIME$, 1)
END IF

_PRINTSTRING (4, 8), STR$(frameRate)
END SUB

Offline Ashish

  • The joy of coding is endless.
Re: Star Backgound
« Reply #23 on: June 17, 2018, 03:19:06 AM »
Hi CodeHunter!
Here's my fire MOD to your spaceship. :)
The amount of flame vary with speed of spaceship.

Code: [Select]

'Original by CodeHunter
'Fire MOD by Ashish
_TITLE "Space the Final Frontier [Fire MOD]"

RANDOMIZE TIMER

DIM SHARED fireSizeX, fireSizeY
fireSizeX = 120
fireSizeY = 19
DIM SHARED fireBuffer(fireSizeX, fireSizeY), colorPal(255) AS _UNSIGNED LONG, fuelControl
fuelControl = 0.23
'creating our palette for fire
FOR i = 255 TO 0 STEP -1
    IF i <= 255 AND i >= 200 THEN 'white to yellow
        colorPal(i) = _RGB32(map(i, 255, 200, 255, 255), map(i, 255, 200, 255, 242), map(i, 255, 200, 255, 0))
    ELSEIF i <= 201 AND i >= 79 THEN 'yellow to orange
        colorPal(i) = _RGB32(map(i, 201, 79, 255, 221), map(i, 201, 79, 242, 140), map(i, 201, 79, 0, 0))
    ELSEIF i <= 89 AND i >= 79 THEN 'orange to dark orange red
        colorPal(i) = _RGB32(map(i, 89, 79, 221, 183), map(i, 89, 79, 140, 45), map(i, 89, 79, 0, 0))
    ELSEIF i <= 78 AND i >= 0 THEN 'dark orange red to transparent
        colorPal(i) = _RGBA32(map(i, 78, 0, 183, 0), map(i, 78, 0, 45, 0), map(i, 78, 0, 0, 0), map(i, 78, 0, 255, 0))
    END IF
NEXT


DIM Touch AS STRING

DIM SHARED frameRate AS INTEGER
DIM SHARED frameCount AS INTEGER

DIM SHARED frameTime AS STRING
frameTime = RIGHT$(TIME$, 2)

' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 800
sHeight = 600

SCREEN _NEWIMAGE(sWidth, sHeight, 32)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED starBack AS LONG
DIM SHARED Starship AS LONG

' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
starBack = _LOADIMAGE(".\images\Stars.png")
_PUTIMAGE (0, 0), starBack

' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
Starship = _LOADIMAGE(".\images\Starship.png")
_CLEARCOLOR _RGB(0, 0, 0), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Used to make sure Starship doesn't go offscreen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
wShip = sWidth - 400
hShip = sHeight - 170

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED shipX AS INTEGER
DIM SHARED shipY AS INTEGER
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85

' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
DIM SHARED warpSpeed AS INTEGER
warpSpeed = 2

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
TYPE Celestial
    ' Location
    x AS INTEGER
    y AS INTEGER

    ' Size
    w AS INTEGER
    h AS INTEGER

    ' Rotation
    c AS INTEGER
    r AS INTEGER

    ' Planet used
    used AS INTEGER

    ' Planet Spins
    spin AS INTEGER

    image AS LONG
END TYPE

' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
DIM SHARED Stars(2) AS Celestial

Stars(1).x = 0
Stars(2).x = 800

Stars(1).image = _NEWIMAGE(800, 600, 32)
_PUTIMAGE (0, 0), starBack, Stars(1).image

Stars(2).image = _NEWIMAGE(800, 600, 32)
Frontier

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."

y = sHeight \ 2 - 8
x = sWidth \ 2 - (LEN(Touch) * 4)
_PRINTSTRING (x, y), Touch

DIM SHARED PlanetView(4) AS INTEGER

DIM SHARED Planet(40) AS Celestial

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR p = 1 TO 40
    ' Planets:
    ' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
    Planet(p).image = _LOADIMAGE(".\images\Planet" + RIGHT$("0" + LTRIM$(STR$(p)), 2) + ".png")
    _CLEARCOLOR _RGB(0, 0, 0), Planet(p).image

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Get the Width and Height of the planet
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Planet(p).w = _WIDTH(Planet(p).image)
    Planet(p).h = _HEIGHT(Planet(p).image)
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
FOR x = -400 TO shipX STEP 10
    'fire
    FOR fy = 3 TO fireSizeY - 2
        fireBuffer(fireSizeX - 2, fy) = INT(RND * 128) + 128
    NEXT
    FOR fy = 3 TO fireSizeY - 2
        FOR fx = 0 TO fireSizeX - 2
            fireBuffer(fx, fy) = (fireBuffer(fx + 1, fy - 1) + fireBuffer(fx + 1, fy) + fireBuffer(fx + 2, fy) + fireBuffer(fx + 1, fy + 1)) * (fuelControl + .018327)
    NEXT fx, fy

    _PUTIMAGE (0, 0), starBack

    'rendering fire
    FOR fy = 0 TO fireSizeY
        FOR fx = 0 TO fireSizeX
            'PRINT INT(fireBuffer(fx, fy))
            PSET (fx + x + 115 - fireSizeX + 2, fy + shipY + 100), colorPal(INT(fireBuffer(fx, fy)))
    NEXT fx, fy

    _PUTIMAGE (x, shipY), Starship

    _DISPLAY
    _LIMIT 30
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
WHILE Touch <> CHR$(27)
    Background


    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Checks to see if a key is pressed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Touch = INKEY$
    IF Touch <> "" THEN
        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Keys 0-9 changes the warpspeed
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF ASC(Touch) > 47 AND ASC(Touch) < 58 THEN warpSpeed = VAL(Touch)

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Home key centers the Starship
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF Touch = CHR$(0) + CHR$(71) THEN
            shipX = sWidth \ 2 - 200
            shipY = sHeight \ 2 - 85
        END IF

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Up and Down Arrow Keys moves the Starship
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF Touch = CHR$(0) + CHR$(72) THEN
            shipY = shipY - warpSpeed
            IF shipY < 0 THEN shipY = 0
        END IF

        IF Touch = CHR$(0) + CHR$(80) THEN
            shipY = shipY + warpSpeed
            IF shipY > hShip THEN shipY = hShip
        END IF
    END IF

    Framed

    _DISPLAY
    _LIMIT 60
WEND
END

SUB Background
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Places the stars Backgrounds
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    _PUTIMAGE (Stars(1).x, 0), Stars(1).image
    _PUTIMAGE (Stars(2).x, 0), Stars(2).image

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Show planet(s)  (if available)
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    FOR v = 1 TO 2
        IF PlanetView(v) > 0 THEN
            ViewPlanet PlanetView(v), v
        END IF
    NEXT
    acc = (warpSpeed + 1) * .001905#
    'fire
    FOR fy = 3 TO fireSizeY - 2
        fireBuffer(fireSizeX - 2, fy) = INT(RND * 128) + 128
    NEXT
    FOR fy = 3 TO fireSizeY - 2
        FOR fx = 0 TO fireSizeX - 2
            fireBuffer(fx, fy) = (fireBuffer(fx + 1, fy - 1) + fireBuffer(fx + 1, fy) + fireBuffer(fx + 2, fy) + fireBuffer(fx + 1, fy + 1)) * (fuelControl + acc)
    NEXT fx, fy
    'rendering fire
    FOR fy = 0 TO fireSizeY
        FOR fx = 0 TO fireSizeX
            'PRINT INT(fireBuffer(fx, fy))
            PSET (fx + shipX + 115 - fireSizeX + 2, fy + shipY + 100), colorPal(INT(fireBuffer(fx, fy)))
    NEXT fx, fy


    ' \/\/\/\/\/\/\/\/\/
    ' Show the Starship
    ' /\/\/\/\/\/\/\/\/\
    _PUTIMAGE (shipX, shipY), Starship

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Have the background shift left by warpspeed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Stars(1).x = Stars(1).x - warpSpeed
    Stars(2).x = Stars(2).x - warpSpeed

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' When the background reaches the end reset background
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Stars(2).x < 0 THEN
        Stars(1).x = 0
        Stars(2).x = 800

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Put the second image on the first to keep the animation proper
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        _PUTIMAGE (0, 0), Stars(2).image, Stars(1).image

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Add Planets to the animation
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
        Frontier
    END IF
END SUB

SUB Frontier
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Reset the background and rotate to make things different
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    SELECT CASE INT(4 * RND)
        CASE 0: _PUTIMAGE (0, 0), starBack, Stars(2).image
        CASE 1: _PUTIMAGE (799, 0)-(0, 599), starBack, Stars(2).image
        CASE 2: _PUTIMAGE (0, 599)-(799, 0), starBack, Stars(2).image
        CASE 3: _PUTIMAGE (799, 599)-(0, 0), starBack, Stars(2).image
    END SELECT

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Choose a Planet to display
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\
    tag1:
    p1 = INT(40 * RND) + 1
    IF Planet(p1).used = 1 THEN GOTO tag1

    ' \/\/\/\/\/\/\/\/\/\/\/\/
    ' Get the Width and Height
    ' /\/\/\/\/\/\/\/\/\/\/\/\
    w = Planet(p1).w
    h = Planet(p1).h

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Make sure planet isn't going off the screen
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    x1 = INT((sWidth - w) * RND)
    y1 = INT((sHeight - h) * RND)

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Set the Planet as used and save the location
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF PlanetView(1) = 0 THEN
        PlanetView(1) = p1
        'ELSE
        '  PlanetView(3) = p1
    END IF

    Planet(p1).x = 800 + x1
    Planet(p1).y = y1

    Planet(p1).used = 1
    Planet(p1).spin = INT(2 * RND)

    IF INT(2 * RND) = 1 THEN
        tag2:
        p2 = INT(40 * RND) + 1
        IF Planet(p2).used = 1 THEN GOTO tag2

        w = Planet(p2).w
        h = Planet(p2).h

        IF p2 <> p1 THEN
            IF w < Planet(p1).w AND h < Planet(p1).h THEN
                x2 = INT((sWidth - w) * RND)
                y2 = INT((sHeight - h) * RND)
            END IF
        END IF

        IF PlanetView(2) = 0 THEN
            PlanetView(2) = p2
            'ELSE
            '  PlanetView(4) = p2
        END IF

        Planet(p2).x = 800 + x2
        Planet(p2).y = y2

        Planet(p2).used = 1
        Planet(p2).spin = INT(2 * RND)
    END IF
END SUB

SUB ViewPlanet (p, v)
    'w = Planet(p).w

    'x = Planet(p).x
    'y = Planet(p).y
    '_PUTIMAGE (x, y), Planet(p).image, 0

    'x = x - 2
    'Planet(p).x = x
    '_PRINTSTRING (4, sHeight \ 2 - 8), STR$(x) + "    "

    'IF x + w < 0 THEN
    '  BEEP
    '  PlanetView(v) = 0
    '  Planet(p).used = 0
    'END IF
    'EXIT SUB

    w = Planet(p).w
    h = Planet(p).h

    x1 = Planet(p).x
    x2 = Planet(p).x + w

    y1 = Planet(p).y
    y2 = Planet(p).y + h

    SELECT CASE Planet(p).r
        CASE 0: _PUTIMAGE (x1, y1), Planet(p).image, 0
        CASE 1: _PUTIMAGE (x2, y1)-(x1, y2), Planet(p).image, 0
        CASE 2: _PUTIMAGE (x1, y2)-(x2, y1), Planet(p).image, 0
        CASE 3: _PUTIMAGE (x2, y2)-(x1, y1), Planet(p).image, 0
    END SELECT

    IF Planet(p).spin = 1 THEN
        Planet(p).c = Planet(p).c + 1

        IF Planet(p).c = 16 THEN
            Planet(p).c = 0

            Planet(p).r = Planet(p).r + 1
            IF Planet(p).r > 3 THEN Planet(p).r = 0
        END IF
    END IF

    x1 = x1 - warpSpeed
    Planet(p).x = x1

    IF x2 < 0 THEN
        PlanetView(v) = 0
        Planet(p).used = 0
    END IF
END SUB

SUB Framed
    IF RIGHT$(TIME$, 1) = frameTime THEN
        frameCount = frameCount + 1
    ELSE
        frameRate = frameCount

        frameCount = 0
        frameTime = RIGHT$(TIME$, 1)
    END IF

    _PRINTSTRING (4, 8), STR$(frameRate)
END SUB


'from p5js.bas
FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
END FUNCTION

if (Me.success) {Me.improve()} else {Me.tryAgain()}


aKFrameWork - http://bit.ly/aKFrameWork
Menu System - http://bit.ly/guiMenuBar
p5.js in QB64 - http://bit.ly/p5jsbas

@KingOfCoders

Offline Petr

  • I am instructed.
Re: Star Backgound
« Reply #24 on: June 17, 2018, 06:07:42 AM »
Very nice original by Code Hunter and also modification by Ashish! :-D

Offline johnno56

  • Live long and prosper.
Re: Star Backgound
« Reply #25 on: June 17, 2018, 06:11:38 AM »
Ok. I have modified ALL of the images. All images now have a transparent background and all 'black' has been replaced by a complimentary colour. All images resized and centered. I ran the program with the modified images and everything looks fine. No missing patches... Cool.

BUT... In the meantime... 'Rotating' planets has been introduced... All of the modified spherical planets 'rotate' just fine. All that have rings look weird when rotating. Suggest that these planets do not rotate.

I have some ideas for rotating ringed planets but it may take some time to work on them.

I have attached all of the modified images. Make a backup copy of the originals then replace them with these....

J

ps: "Attachments and other options" does NOT include a browse to file. I will attempt to include a link. I hope I get this right...

https://www.dropbox.com/s/zgpmn9ly4tnp3bx/planets.zip?dl=0
Logic is the beginning of wisdom.

Re: Star Backgound
« Reply #26 on: June 17, 2018, 08:20:06 AM »
Hi CodeHunter!
Here's my fire MOD to your spaceship. :)
The amount of flame vary with speed of spaceship.

Very nice Ashish, but I prefer not to have fire.

Very nice original by Code Hunter and also modification by Ashish! :-D

Thank you Petr.  As much as it was a pain to accomplish, I am quite happy at the outcome and the good responses that I have received.

Ok. I have modified ALL of the images. All images now have a transparent background and all 'black' has been replaced by a complimentary colour. All images resized and centered. I ran the program with the modified images and everything looks fine. No missing patches... Cool.

BUT... In the meantime... 'Rotating' planets has been introduced... All of the modified spherical planets 'rotate' just fine. All that have rings look weird when rotating. Suggest that these planets do not rotate.

I have some ideas for rotating ringed planets but it may take some time to work on them.

I have attached all of the modified images. Make a backup copy of the originals then replace them with these....

J

ps: "Attachments and other options" does NOT include a browse to file. I will attempt to include a link. I hope I get this right...

https://www.dropbox.com/s/zgpmn9ly4tnp3bx/planets.zip?dl=0


Thank you Johnno56 for your fixes to the planets.

I have updated the code.  It seemed to freeze on the old code after a while and hopefully that is fixed.  Also updated code and the planets so that no 'ringed' planets will rotate.

See link for the updated archive for the new images: https://qb64.org/binbin/D8A2/images.zip

Code: [Select]
_TITLE "Space the Final Frontier"

RANDOMIZE TIMER

DIM Touch AS STRING

DIM SHARED frameRate AS INTEGER
DIM SHARED frameCount AS INTEGER

DIM SHARED frameTime AS STRING
frameTime = RIGHT$(TIME$, 2)

' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 800
sHeight = 600

SCREEN _NEWIMAGE(sWidth, sHeight, 32)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED starBack AS LONG
DIM SHARED Starship AS LONG

' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
starBack = _LOADIMAGE(".\images\Stars.png")
_PUTIMAGE (0, 0), starBack

' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
Starship = _LOADIMAGE(".\images\Starship.png")
_CLEARCOLOR _RGB(0, 0, 0), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Used to make sure Starship doesn't go offscreen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
wShip = sWidth - 400
hShip = sHeight - 170

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED shipX AS INTEGER
DIM SHARED shipY AS INTEGER
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85

' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
DIM SHARED warpSpeed AS INTEGER
warpSpeed = 2

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
TYPE Celestial
  ' Location
  x AS INTEGER
  y AS INTEGER

  ' Size
  w AS INTEGER
  h AS INTEGER

  ' Rotation
  c AS INTEGER
  r AS INTEGER

  ' Planet used
  used AS INTEGER

  ' Planet Spins
  spin AS INTEGER

  image AS LONG
END TYPE

' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
DIM SHARED Stars(2) AS Celestial

Stars(1).x = 0
Stars(2).x = 800

Stars(1).image = _NEWIMAGE(800, 600, 32)
_PUTIMAGE (0, 0), starBack, Stars(1).image

Stars(2).image = _NEWIMAGE(800, 600, 32)
Starfield
Frontier

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."

y = sHeight \ 2 - 8
x = sWidth \ 2 - (LEN(Touch) * 4)
_PRINTSTRING (x, y), Touch

DIM SHARED PlanetView(4) AS INTEGER

DIM SHARED Planet(40) AS Celestial

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR p = 1 TO 40
  ' Planets:
  ' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
  Planet(p).image = _LOADIMAGE(".\images\Planet" + RIGHT$("0" + LTRIM$(STR$(p)), 2) + ".png")
  _CLEARCOLOR _RGB(0, 0, 0), Planet(p).image

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Get the Width and Height of the planet
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Planet(p).w = _WIDTH(Planet(p).image)
  Planet(p).h = _HEIGHT(Planet(p).image)
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
FOR x = -400 TO shipX STEP 10
  _PUTIMAGE (0, 0), starBack
  _PUTIMAGE (x, shipY), Starship

  _DISPLAY
  _LIMIT 30
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
WHILE Touch <> CHR$(27)
  Background

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Checks to see if a key is pressed
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Touch = INKEY$
  IF Touch <> "" THEN
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Keys 0-9 changes the warpspeed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF ASC(Touch) > 47 AND ASC(Touch) < 58 THEN warpSpeed = VAL(Touch)

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Home key centers the Starship
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Touch = CHR$(0) + CHR$(71) THEN
      shipX = sWidth \ 2 - 200
      shipY = sHeight \ 2 - 85
    END IF

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Up and Down Arrow Keys moves the Starship
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Touch = CHR$(0) + CHR$(72) THEN
      shipY = shipY - warpSpeed
      IF shipY < 0 THEN shipY = 0
    END IF

    IF Touch = CHR$(0) + CHR$(80) THEN
      shipY = shipY + warpSpeed
      IF shipY > hShip THEN shipY = hShip
    END IF
  END IF

  'Framed

  _DISPLAY
  _LIMIT 60
WEND
END

SUB Background
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Places the stars Backgrounds
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
_PUTIMAGE (Stars(1).x, 0), Stars(1).image
_PUTIMAGE (Stars(2).x, 0), Stars(2).image

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show planet(s)  (if available)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR v = 1 TO 2
  IF PlanetView(v) > 0 THEN
    ViewPlanet PlanetView(v), v
  END IF
NEXT

' \/\/\/\/\/\/\/\/\/
' Show the Starship
' /\/\/\/\/\/\/\/\/\
_PUTIMAGE (shipX, shipY), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Have the background shift left by warpspeed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Stars(1).x = Stars(1).x - warpSpeed
Stars(2).x = Stars(2).x - warpSpeed

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' When the background reaches the end reset background
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
IF Stars(2).x < 0 THEN
  Stars(1).x = 0
  Stars(2).x = 800

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Put the second image on the first to keep the animation proper
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  _PUTIMAGE (0, 0), Stars(2).image, Stars(1).image

  Starfield
END IF
END SUB

SUB Frontier
' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Choose a Planet to display
' /\/\/\/\/\/\/\/\/\/\/\/\/\
'tag1:
p1 = INT(40 * RND) + 1
'IF Planet(p1).used = 1 THEN GOTO tag1

' \/\/\/\/\/\/\/\/\/\/\/\/
' Get the Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
w = Planet(p1).w
h = Planet(p1).h

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Make sure planet isn't going off the screen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
x1 = INT((sWidth - w) * RND)
y1 = INT((sHeight - h) * RND)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Set the Planet as used and save the location
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
PlanetView(1) = p1

Planet(p1).x = 800 + x1
Planet(p1).y = y1

Planet(p1).used = 1
IF p1 < 29 THEN Planet(p2).spin = INT(2 * RND)

IF INT(2 * RND) = 1 THEN
  p2 = INT(40 * RND) + 1

  w = Planet(p2).w
  h = Planet(p2).h

  IF p2 <> p1 THEN
    IF w < Planet(p1).w AND h < Planet(p1).h THEN
      x2 = INT((sWidth - w) * RND)
      y2 = INT((sHeight - h) * RND)
    END IF
  END IF

  PlanetView(2) = p2

  Planet(p2).x = 800 + x2
  Planet(p2).y = y2

  Planet(p2).used = 1

  IF p2 < 29 THEN Planet(p2).spin = INT(2 * RND)
END IF
END SUB

SUB Starfield
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Reset the background and rotate to make things different
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
SELECT CASE INT(4 * RND)
  CASE 0: _PUTIMAGE (0, 0), starBack, Stars(2).image
  CASE 1: _PUTIMAGE (799, 0)-(0, 599), starBack, Stars(2).image
  CASE 2: _PUTIMAGE (0, 599)-(799, 0), starBack, Stars(2).image
  CASE 3: _PUTIMAGE (799, 599)-(0, 0), starBack, Stars(2).image
END SELECT
END SUB

SUB ViewPlanet (p, v)
w = Planet(p).w
h = Planet(p).h

x1 = Planet(p).x
x2 = Planet(p).x + w

y1 = Planet(p).y
y2 = Planet(p).y + h

SELECT CASE Planet(p).r
  CASE 0: _PUTIMAGE (x1, y1), Planet(p).image, 0
  CASE 1: _PUTIMAGE (x2, y1)-(x1, y2), Planet(p).image, 0
  CASE 2: _PUTIMAGE (x1, y2)-(x2, y1), Planet(p).image, 0
  CASE 3: _PUTIMAGE (x2, y2)-(x1, y1), Planet(p).image, 0
END SELECT

IF Planet(p).spin = 1 THEN
  Planet(p).c = Planet(p).c + 1

  IF Planet(p).c = 16 THEN
    Planet(p).c = 0

    Planet(p).r = Planet(p).r + 1
    IF Planet(p).r > 3 THEN Planet(p).r = 0
  END IF
END IF

x1 = x1 - warpSpeed
Planet(p).x = x1

IF x1 + w < 0 THEN
  PlanetView(v) = 0
  Planet(p).used = 0

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Add Planets to the animation
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Frontier
END IF
END SUB

SUB Framed
IF RIGHT$(TIME$, 1) = frameTime THEN
  frameCount = frameCount + 1
ELSE
  frameRate = frameCount

  frameCount = 0
  frameTime = RIGHT$(TIME$, 1)
END IF

_PRINTSTRING (4, 8), STR$(frameRate)
END SUB

Re: Star Backgound
« Reply #27 on: June 17, 2018, 08:36:58 AM »
Here is a quick modification to include the fire MOD from Ashish into the program.

By default the MOD is off.  Use the 'M' key to Enable/Disable the MOD.

I am uploading this for those who likes the MOD and would like it included.

Code: [Select]
_TITLE "Space the Final Frontier"

RANDOMIZE TIMER

DIM Touch AS STRING

DIM SHARED frameRate AS INTEGER
DIM SHARED frameCount AS INTEGER

DIM SHARED frameTime AS STRING
frameTime = RIGHT$(TIME$, 2)

DIM SHARED modFire AS _BYTE
modFire = 0

DIM SHARED fireSizeX, fireSizeY
fireSizeX = 120
fireSizeY = 19

DIM SHARED fireBuffer(fireSizeX, fireSizeY), colorPal(255) AS _UNSIGNED LONG, fuelControl
fuelControl = 0.23

'creating our palette for fire
FOR i = 255 TO 0 STEP -1
  IF i <= 255 AND i >= 200 THEN 'white to yellow
    colorPal(i) = _RGB32(map(i, 255, 200, 255, 255), map(i, 255, 200, 255, 242), map(i, 255, 200, 255, 0))
  ELSEIF i <= 201 AND i >= 79 THEN 'yellow to orange
    colorPal(i) = _RGB32(map(i, 201, 79, 255, 221), map(i, 201, 79, 242, 140), map(i, 201, 79, 0, 0))
  ELSEIF i <= 89 AND i >= 79 THEN 'orange to dark orange red
    colorPal(i) = _RGB32(map(i, 89, 79, 221, 183), map(i, 89, 79, 140, 45), map(i, 89, 79, 0, 0))
  ELSEIF i <= 78 AND i >= 0 THEN 'dark orange red to transparent
    colorPal(i) = _RGBA32(map(i, 78, 0, 183, 0), map(i, 78, 0, 45, 0), map(i, 78, 0, 0, 0), map(i, 78, 0, 255, 0))
  END IF
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 800
sHeight = 600

SCREEN _NEWIMAGE(sWidth, sHeight, 32)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED starBack AS LONG
DIM SHARED Starship AS LONG

' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
starBack = _LOADIMAGE(".\images\Stars.png")
_PUTIMAGE (0, 0), starBack

' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
Starship = _LOADIMAGE(".\images\Starship.png")
_CLEARCOLOR _RGB(0, 0, 0), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Used to make sure Starship doesn't go offscreen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
wShip = sWidth - 400
hShip = sHeight - 170

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED shipX AS INTEGER
DIM SHARED shipY AS INTEGER
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85

' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
DIM SHARED warpSpeed AS INTEGER
warpSpeed = 2

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
TYPE Celestial
  ' Location
  x AS INTEGER
  y AS INTEGER

  ' Size
  w AS INTEGER
  h AS INTEGER

  ' Rotation
  c AS INTEGER
  r AS INTEGER

  ' Planet used
  used AS INTEGER

  ' Planet Spins
  spin AS INTEGER

  image AS LONG
END TYPE

' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
DIM SHARED Stars(2) AS Celestial

Stars(1).x = 0
Stars(2).x = 800

Stars(1).image = _NEWIMAGE(800, 600, 32)
_PUTIMAGE (0, 0), starBack, Stars(1).image

Stars(2).image = _NEWIMAGE(800, 600, 32)
Starfield
Frontier

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."

y = sHeight \ 2 - 8
x = sWidth \ 2 - (LEN(Touch) * 4)
_PRINTSTRING (x, y), Touch

DIM SHARED PlanetView(4) AS INTEGER

DIM SHARED Planet(40) AS Celestial

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR p = 1 TO 40
  ' Planets:
  ' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
  Planet(p).image = _LOADIMAGE(".\images\Planet" + RIGHT$("0" + LTRIM$(STR$(p)), 2) + ".png")
  _CLEARCOLOR _RGB(0, 0, 0), Planet(p).image

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Get the Width and Height of the planet
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Planet(p).w = _WIDTH(Planet(p).image)
  Planet(p).h = _HEIGHT(Planet(p).image)
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
FOR x = -400 TO shipX STEP 10
  IF modFire = 1 THEN
    'fire
    FOR fy = 3 TO fireSizeY - 2
      fireBuffer(fireSizeX - 2, fy) = INT(RND * 128) + 128
    NEXT
    FOR fy = 3 TO fireSizeY - 2
      FOR fx = 0 TO fireSizeX - 2
        fireBuffer(fx, fy) = (fireBuffer(fx + 1, fy - 1) + fireBuffer(fx + 1, fy) + fireBuffer(fx + 2, fy) + fireBuffer(fx + 1, fy + 1)) * (fuelControl + .018327)
    NEXT fx, fy
  END IF

  _PUTIMAGE (0, 0), starBack

  IF modFire = 1 THEN
    'rendering fire
    FOR fy = 0 TO fireSizeY
      FOR fx = 0 TO fireSizeX
        'PRINT INT(fireBuffer(fx, fy))
        PSET (fx + x + 115 - fireSizeX + 2, fy + shipY + 100), colorPal(INT(fireBuffer(fx, fy)))
    NEXT fx, fy
  END IF

  _PUTIMAGE (x, shipY), Starship

  _DISPLAY
  _LIMIT 30
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
WHILE Touch <> CHR$(27)
  Background

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Checks to see if a key is pressed
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Touch = INKEY$
  IF Touch <> "" THEN
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Keys 0-9 changes the warpspeed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF ASC(Touch) > 47 AND ASC(Touch) < 58 THEN warpSpeed = VAL(Touch)

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' M key will add the fire mod
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF UCASE$(Touch) = "M" THEN
      IF modFire = 0 THEN modFire = 1 ELSE modFire = 0
    END IF

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Home key centers the Starship
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Touch = CHR$(0) + CHR$(71) THEN
      shipX = sWidth \ 2 - 200
      shipY = sHeight \ 2 - 85
    END IF

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Up and Down Arrow Keys moves the Starship
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Touch = CHR$(0) + CHR$(72) THEN
      shipY = shipY - warpSpeed
      IF shipY < 0 THEN shipY = 0
    END IF

    IF Touch = CHR$(0) + CHR$(80) THEN
      shipY = shipY + warpSpeed
      IF shipY > hShip THEN shipY = hShip
    END IF
  END IF

  'Framed

  _DISPLAY
  _LIMIT 60
WEND
END

FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
END FUNCTION

SUB Background
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Places the stars Backgrounds
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
_PUTIMAGE (Stars(1).x, 0), Stars(1).image
_PUTIMAGE (Stars(2).x, 0), Stars(2).image

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show planet(s)  (if available)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR v = 1 TO 2
  IF PlanetView(v) > 0 THEN
    ViewPlanet PlanetView(v), v
  END IF
NEXT

IF modFire = 1 THEN
  acc = (warpSpeed + 1) * .001905#

  'fire
  FOR fy = 3 TO fireSizeY - 2
    fireBuffer(fireSizeX - 2, fy) = INT(RND * 128) + 128
  NEXT

  FOR fy = 3 TO fireSizeY - 2
    FOR fx = 0 TO fireSizeX - 2
      fireBuffer(fx, fy) = (fireBuffer(fx + 1, fy - 1) + fireBuffer(fx + 1, fy) + fireBuffer(fx + 2, fy) + fireBuffer(fx + 1, fy + 1)) * (fuelControl + acc)
  NEXT fx, fy

  'rendering fire
  FOR fy = 0 TO fireSizeY
    FOR fx = 0 TO fireSizeX
      'PRINT INT(fireBuffer(fx, fy))
      PSET (fx + shipX + 115 - fireSizeX + 2, fy + shipY + 100), colorPal(INT(fireBuffer(fx, fy)))
  NEXT fx, fy
END IF

' \/\/\/\/\/\/\/\/\/
' Show the Starship
' /\/\/\/\/\/\/\/\/\
_PUTIMAGE (shipX, shipY), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Have the background shift left by warpspeed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Stars(1).x = Stars(1).x - warpSpeed
Stars(2).x = Stars(2).x - warpSpeed

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' When the background reaches the end reset background
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
IF Stars(2).x < 0 THEN
  Stars(1).x = 0
  Stars(2).x = 800

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Put the second image on the first to keep the animation proper
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  _PUTIMAGE (0, 0), Stars(2).image, Stars(1).image

  Starfield
END IF
END SUB

SUB Frontier
' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Choose a Planet to display
' /\/\/\/\/\/\/\/\/\/\/\/\/\
'tag1:
p1 = INT(40 * RND) + 1
'IF Planet(p1).used = 1 THEN GOTO tag1

' \/\/\/\/\/\/\/\/\/\/\/\/
' Get the Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
w = Planet(p1).w
h = Planet(p1).h

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Make sure planet isn't going off the screen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
x1 = INT((sWidth - w) * RND)
y1 = INT((sHeight - h) * RND)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Set the Planet as used and save the location
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
PlanetView(1) = p1

Planet(p1).x = 800 + x1
Planet(p1).y = y1

Planet(p1).used = 1
IF p1 < 29 THEN Planet(p2).spin = INT(2 * RND)

IF INT(2 * RND) = 1 THEN
  p2 = INT(40 * RND) + 1

  w = Planet(p2).w
  h = Planet(p2).h

  IF p2 <> p1 THEN
    IF w < Planet(p1).w AND h < Planet(p1).h THEN
      x2 = INT((sWidth - w) * RND)
      y2 = INT((sHeight - h) * RND)
    END IF
  END IF

  PlanetView(2) = p2

  Planet(p2).x = 800 + x2
  Planet(p2).y = y2

  Planet(p2).used = 1

  IF p2 < 29 THEN Planet(p2).spin = INT(2 * RND)
END IF
END SUB

SUB Starfield
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Reset the background and rotate to make things different
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
SELECT CASE INT(4 * RND)
  CASE 0: _PUTIMAGE (0, 0), starBack, Stars(2).image
  CASE 1: _PUTIMAGE (799, 0)-(0, 599), starBack, Stars(2).image
  CASE 2: _PUTIMAGE (0, 599)-(799, 0), starBack, Stars(2).image
  CASE 3: _PUTIMAGE (799, 599)-(0, 0), starBack, Stars(2).image
END SELECT
END SUB

SUB ViewPlanet (p, v)
w = Planet(p).w
h = Planet(p).h

x1 = Planet(p).x
x2 = Planet(p).x + w

y1 = Planet(p).y
y2 = Planet(p).y + h

SELECT CASE Planet(p).r
  CASE 0: _PUTIMAGE (x1, y1), Planet(p).image, 0
  CASE 1: _PUTIMAGE (x2, y1)-(x1, y2), Planet(p).image, 0
  CASE 2: _PUTIMAGE (x1, y2)-(x2, y1), Planet(p).image, 0
  CASE 3: _PUTIMAGE (x2, y2)-(x1, y1), Planet(p).image, 0
END SELECT

IF Planet(p).spin = 1 THEN
  Planet(p).c = Planet(p).c + 1

  IF Planet(p).c = 16 THEN
    Planet(p).c = 0

    Planet(p).r = Planet(p).r + 1
    IF Planet(p).r > 3 THEN Planet(p).r = 0
  END IF
END IF

x1 = x1 - warpSpeed
Planet(p).x = x1

IF x1 + w < 0 THEN
  PlanetView(v) = 0
  Planet(p).used = 0

  ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
  ' Add Planets to the animation
  ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
  Frontier
END IF
END SUB

SUB Framed
IF RIGHT$(TIME$, 1) = frameTime THEN
  frameCount = frameCount + 1
ELSE
  frameRate = frameCount

  frameCount = 0
  frameTime = RIGHT$(TIME$, 1)
END IF

_PRINTSTRING (4, 8), STR$(frameRate)
END SUB

Online FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: Star Backgound
« Reply #28 on: June 17, 2018, 11:13:57 AM »
Great job, Code Hunter. And welcome back to the forum.

Ashish's fire mod definitely adds a fine touch here too.

Here's my humble contribution to the y-axis movement (up/down arrows):
Code: [Select]
_TITLE "Space the Final Frontier"

RANDOMIZE TIMER
CONST true = -1, false = NOT true
DIM Touch AS STRING

DIM SHARED frameRate AS INTEGER
DIM SHARED frameCount AS INTEGER

DIM SHARED frameTime AS STRING
frameTime = RIGHT$(TIME$, 2)

DIM SHARED modFire AS _BYTE
modFire = true

DIM SHARED fireSizeX, fireSizeY
fireSizeX = 120
fireSizeY = 19

DIM SHARED fireBuffer(fireSizeX, fireSizeY), colorPal(255) AS _UNSIGNED LONG, fuelControl
fuelControl = 0.23

'creating our palette for fire
FOR i = 255 TO 0 STEP -1
    IF i <= 255 AND i >= 200 THEN 'white to yellow
        colorPal(i) = _RGB32(map(i, 255, 200, 255, 255), map(i, 255, 200, 255, 242), map(i, 255, 200, 255, 0))
    ELSEIF i <= 201 AND i >= 79 THEN 'yellow to orange
        colorPal(i) = _RGB32(map(i, 201, 79, 255, 221), map(i, 201, 79, 242, 140), map(i, 201, 79, 0, 0))
    ELSEIF i <= 89 AND i >= 79 THEN 'orange to dark orange red
        colorPal(i) = _RGB32(map(i, 89, 79, 221, 183), map(i, 89, 79, 140, 45), map(i, 89, 79, 0, 0))
    ELSEIF i <= 78 AND i >= 0 THEN 'dark orange red to transparent
        colorPal(i) = _RGBA32(map(i, 78, 0, 183, 0), map(i, 78, 0, 45, 0), map(i, 78, 0, 0, 0), map(i, 78, 0, 255, 0))
    END IF
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED sWidth AS INTEGER
DIM SHARED sHeight AS INTEGER
sWidth = 800
sHeight = 600

SCREEN _NEWIMAGE(sWidth, sHeight, 32)

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED starBack AS LONG
DIM SHARED Starship AS LONG

' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
starBack = _LOADIMAGE(".\images\Stars.png")
_PUTIMAGE (0, 0), starBack

' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
Starship = _LOADIMAGE(".\images\Starship.png")
_CLEARCOLOR _RGB(0, 0, 0), Starship

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Used to make sure Starship doesn't go offscreen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
wShip = sWidth - 400
hShip = sHeight - 170

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
DIM SHARED shipX AS INTEGER
DIM SHARED shipY AS INTEGER
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85

' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
DIM SHARED warpSpeed AS INTEGER
warpSpeed = 2

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
TYPE Celestial
    ' Location
    x AS INTEGER
    y AS INTEGER

    ' Size
    w AS INTEGER
    h AS INTEGER

    ' Rotation
    c AS INTEGER
    r AS INTEGER

    ' Planet used
    used AS INTEGER

    ' Planet Spins
    spin AS INTEGER

    image AS LONG
END TYPE

' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
DIM SHARED Stars(2) AS Celestial

Stars(1).x = 0
Stars(2).x = 800

Stars(1).image = _NEWIMAGE(800, 600, 32)
_PUTIMAGE (0, 0), starBack, Stars(1).image

Stars(2).image = _NEWIMAGE(800, 600, 32)
Starfield
Frontier

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."

y = sHeight \ 2 - 8
x = sWidth \ 2 - (LEN(Touch) * 4)
_PRINTSTRING (x, y), Touch

DIM SHARED PlanetView(4) AS INTEGER

DIM SHARED Planet(40) AS Celestial

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
FOR p = 1 TO 40
    ' Planets:
    ' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
    Planet(p).image = _LOADIMAGE(".\images\Planet" + RIGHT$("0" + LTRIM$(STR$(p)), 2) + ".png")
    _CLEARCOLOR _RGB(0, 0, 0), Planet(p).image

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Get the Width and Height of the planet
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Planet(p).w = _WIDTH(Planet(p).image)
    Planet(p).h = _HEIGHT(Planet(p).image)
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
FOR x = -400 TO shipX STEP 10
    IF modFire THEN
        'fire
        FOR fy = 3 TO fireSizeY - 2
            fireBuffer(fireSizeX - 2, fy) = INT(RND * 128) + 128
        NEXT
        FOR fy = 3 TO fireSizeY - 2
            FOR fx = 0 TO fireSizeX - 2
                fireBuffer(fx, fy) = (fireBuffer(fx + 1, fy - 1) + fireBuffer(fx + 1, fy) + fireBuffer(fx + 2, fy) + fireBuffer(fx + 1, fy + 1)) * (fuelControl + .018327)
        NEXT fx, fy
    END IF

    _PUTIMAGE (0, 0), starBack

    IF modFire THEN
        'rendering fire
        FOR fy = 0 TO fireSizeY
            FOR fx = 0 TO fireSizeX
                'PRINT INT(fireBuffer(fx, fy))
                PSET (fx + x + 115 - fireSizeX + 2, fy + shipY + 100), colorPal(INT(fireBuffer(fx, fy)))
        NEXT fx, fy
    END IF

    _PUTIMAGE (x, shipY), Starship

    _DISPLAY
    _LIMIT 30
NEXT

' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
WHILE Touch <> CHR$(27)
    Background

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Checks to see if a key is pressed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Touch = INKEY$
    IF Touch <> "" THEN
        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Keys 0-9 changes the warpspeed
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF ASC(Touch) > 47 AND ASC(Touch) < 58 THEN warpSpeed = VAL(Touch)

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' M key will add the fire mod
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF UCASE$(Touch) = "M" THEN
            modFire = NOT modFire
        END IF

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Home key centers the Starship
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF Touch = CHR$(0) + CHR$(71) THEN
            shipX = sWidth \ 2 - 200
            shipY = sHeight \ 2 - 85
        END IF

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Up and Down Arrow Keys moves the Starship
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        IF Touch = CHR$(0) + CHR$(72) THEN
            yMovement = -3
        END IF

        IF Touch = CHR$(0) + CHR$(80) THEN
            yMovement = 3
        END IF
    END IF

    shipY = shipY + yMovement
    IF yMovement > 0.5 THEN yMovement = yMovement - .05
    IF yMovement < -0.5 THEN yMovement = yMovement + .05

    'Framed

    _DISPLAY
    _LIMIT 60
WEND
END

FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
    map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
END FUNCTION

SUB Background
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Places the stars Backgrounds
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    _PUTIMAGE (Stars(1).x, 0), Stars(1).image
    _PUTIMAGE (Stars(2).x, 0), Stars(2).image

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Show planet(s)  (if available)
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    FOR v = 1 TO 2
        IF PlanetView(v) > 0 THEN
            ViewPlanet PlanetView(v), v
        END IF
    NEXT

    IF modFire THEN
        acc = (warpSpeed + 1) * .001905#

        'fire
        FOR fy = 3 TO fireSizeY - 2
            fireBuffer(fireSizeX - 2, fy) = INT(RND * 128) + 128
        NEXT

        FOR fy = 3 TO fireSizeY - 2
            FOR fx = 0 TO fireSizeX - 2
                fireBuffer(fx, fy) = (fireBuffer(fx + 1, fy - 1) + fireBuffer(fx + 1, fy) + fireBuffer(fx + 2, fy) + fireBuffer(fx + 1, fy + 1)) * (fuelControl + acc)
        NEXT fx, fy

        'rendering fire
        FOR fy = 0 TO fireSizeY
            FOR fx = 0 TO fireSizeX
                'PRINT INT(fireBuffer(fx, fy))
                PSET (fx + shipX + 115 - fireSizeX + 2, fy + shipY + 100), colorPal(INT(fireBuffer(fx, fy)))
        NEXT fx, fy
    END IF

    ' \/\/\/\/\/\/\/\/\/
    ' Show the Starship
    ' /\/\/\/\/\/\/\/\/\
    _PUTIMAGE (shipX, shipY), Starship

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Have the background shift left by warpspeed
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    Stars(1).x = Stars(1).x - warpSpeed
    Stars(2).x = Stars(2).x - warpSpeed

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' When the background reaches the end reset background
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    IF Stars(2).x < 0 THEN
        Stars(1).x = 0
        Stars(2).x = 800

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Put the second image on the first to keep the animation proper
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
        _PUTIMAGE (0, 0), Stars(2).image, Stars(1).image

        Starfield
    END IF
END SUB

SUB Frontier
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Choose a Planet to display
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\
    'tag1:
    p1 = INT(40 * RND) + 1
    'IF Planet(p1).used = 1 THEN GOTO tag1

    ' \/\/\/\/\/\/\/\/\/\/\/\/
    ' Get the Width and Height
    ' /\/\/\/\/\/\/\/\/\/\/\/\
    w = Planet(p1).w
    h = Planet(p1).h

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Make sure planet isn't going off the screen
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    x1 = INT((sWidth - w) * RND)
    y1 = INT((sHeight - h) * RND)

    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Set the Planet as used and save the location
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    PlanetView(1) = p1

    Planet(p1).x = 800 + x1
    Planet(p1).y = y1

    Planet(p1).used = 1
    IF p1 < 29 THEN Planet(p2).spin = INT(2 * RND)

    IF INT(2 * RND) = 1 THEN
        p2 = INT(40 * RND) + 1

        w = Planet(p2).w
        h = Planet(p2).h

        IF p2 <> p1 THEN
            IF w < Planet(p1).w AND h < Planet(p1).h THEN
                x2 = INT((sWidth - w) * RND)
                y2 = INT((sHeight - h) * RND)
            END IF
        END IF

        PlanetView(2) = p2

        Planet(p2).x = 800 + x2
        Planet(p2).y = y2

        Planet(p2).used = 1

        IF p2 < 29 THEN Planet(p2).spin = INT(2 * RND)
    END IF
END SUB

SUB Starfield
    ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    ' Reset the background and rotate to make things different
    ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    SELECT CASE INT(4 * RND)
        CASE 0: _PUTIMAGE (0, 0), starBack, Stars(2).image
        CASE 1: _PUTIMAGE (799, 0)-(0, 599), starBack, Stars(2).image
        CASE 2: _PUTIMAGE (0, 599)-(799, 0), starBack, Stars(2).image
        CASE 3: _PUTIMAGE (799, 599)-(0, 0), starBack, Stars(2).image
    END SELECT
END SUB

SUB ViewPlanet (p, v)
    w = Planet(p).w
    h = Planet(p).h

    x1 = Planet(p).x
    x2 = Planet(p).x + w

    y1 = Planet(p).y
    y2 = Planet(p).y + h

    SELECT CASE Planet(p).r
        CASE 0: _PUTIMAGE (x1, y1), Planet(p).image, 0
        CASE 1: _PUTIMAGE (x2, y1)-(x1, y2), Planet(p).image, 0
        CASE 2: _PUTIMAGE (x1, y2)-(x2, y1), Planet(p).image, 0
        CASE 3: _PUTIMAGE (x2, y2)-(x1, y1), Planet(p).image, 0
    END SELECT

    IF Planet(p).spin = 1 THEN
        Planet(p).c = Planet(p).c + 1

        IF Planet(p).c = 16 THEN
            Planet(p).c = 0

            Planet(p).r = Planet(p).r + 1
            IF Planet(p).r > 3 THEN Planet(p).r = 0
        END IF
    END IF

    x1 = x1 - warpSpeed
    Planet(p).x = x1

    IF x1 + w < 0 THEN
        PlanetView(v) = 0
        Planet(p).used = 0

        ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
        ' Add Planets to the animation
        ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
        Frontier
    END IF
END SUB

SUB Framed
    IF RIGHT$(TIME$, 1) = frameTime THEN
        frameCount = frameCount + 1
    ELSE
        frameRate = frameCount

        frameCount = 0
        frameTime = RIGHT$(TIME$, 1)
    END IF

    _PRINTSTRING (4, 8), STR$(frameRate)
END SUB

Re: Star Backgound
« Reply #29 on: June 17, 2018, 12:16:03 PM »
Not suppose to have fire in space but Ashish application is really good!

If you want even more helm control, I have updated RotoZoom:
https://www.qb64.org/forum/index.php?topic=278.0
B = B + ...
QB64 x 64 v1.2 2018 0228/86 git b30af92
QB64 v1.2 20180228/86 git 6fde149
QB64 v1.2 [dev build]_d84bb00