'Original by [banned user]
'Fire MOD by Ashish
_TITLE "Space the Final Frontier [Fire MOD]"
fireSizeX = 120
fireSizeY = 19
fuelControl = 0.23
'creating our palette for fire
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)) colorPal
(i
) = _RGB32(map
(i
, 201, 79, 255, 221), map
(i
, 201, 79, 242, 140), map
(i
, 201, 79, 0, 0)) colorPal
(i
) = _RGB32(map
(i
, 89, 79, 221, 183), map
(i
, 89, 79, 140, 45), map
(i
, 89, 79, 0, 0)) 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))
' \/\/\/\/\/\/\/\/\/\/\/\/
' Screen Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
sWidth = 800
sHeight = 600
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Stars Background and the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' Stars Background:
' https://www.qb64.org/forum/index.php?PHPSESSID=fe200737599194549d14a890bf46be14&topic=250.0
' Starship:
' http://www.clipartlord.com/category/space-clip-art/spaceship-clip-art/
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Used to make sure Starship doesn't go offscreen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
wShip = sWidth - 400
hShip = sHeight - 170
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship Location (Centered)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85
' \/\/\/\/\/\/\/\/\/\/\/
' Speed of the Starship
' /\/\/\/\/\/\/\/\/\/\/\
warpSpeed = 2
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Celestial Objects (Stars and Planets)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' Location
' Size
' Rotation
' Planet used
' Planet Spins
' \/\/\/\/\/\/\/\/
' Stars Background
' /\/\/\/\/\/\/\/\
Stars(1).x = 0
Stars(2).x = 800
Frontier
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Display text while Planets load
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Touch = "Loading Planet Data...."
y = sHeight \ 2 - 8
x
= sWidth \
2 - (LEN(Touch
) * 4)
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Load all the planets (40 total)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' Planets:
' http://www.clipartlord.com/category/space-clip-art/planets-clip-art/
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Get the Width and Height of the planet
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Planet
(p
).w
= _WIDTH(Planet
(p
).image
) Planet
(p
).h
= _HEIGHT(Planet
(p
).image
)
' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Starship enters the scene
' /\/\/\/\/\/\/\/\/\/\/\/\/\
'fire
FOR fy
= 3 TO fireSizeY
- 2 fireBuffer
(fireSizeX
- 2, fy
) = INT(RND * 128) + 128 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)
'rendering fire
'PRINT INT(fireBuffer(fx, fy))
PSET (fx
+ x
+ 115 - fireSizeX
+ 2, fy
+ shipY
+ 100), colorPal
(INT(fireBuffer
(fx
, fy
)))
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show the animations until ESC is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Background
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Checks to see if a key is pressed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Keys 0-9 changes the warpspeed
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Home key centers the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
shipX = sWidth \ 2 - 200
shipY = sHeight \ 2 - 85
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Up and Down Arrow Keys moves the Starship
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
shipY = shipY - warpSpeed
shipY = shipY + warpSpeed
IF shipY
> hShip
THEN shipY
= hShip
Framed
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Places the stars Backgrounds
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Show planet(s) (if available)
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
ViewPlanet PlanetView(v), v
acc = (warpSpeed + 1) * .001905#
'fire
FOR fy
= 3 TO fireSizeY
- 2 fireBuffer
(fireSizeX
- 2, fy
) = INT(RND * 128) + 128 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)
'rendering fire
'PRINT INT(fireBuffer(fx, fy))
PSET (fx
+ shipX
+ 115 - fireSizeX
+ 2, fy
+ shipY
+ 100), colorPal
(INT(fireBuffer
(fx
, fy
)))
' \/\/\/\/\/\/\/\/\/
' Show the 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
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
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
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Reset the background and rotate to make things different
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' \/\/\/\/\/\/\/\/\/\/\/\/\/
' Choose a Planet to display
' /\/\/\/\/\/\/\/\/\/\/\/\/\
tag1:
' \/\/\/\/\/\/\/\/\/\/\/\/
' Get the Width and Height
' /\/\/\/\/\/\/\/\/\/\/\/\
w = Planet(p1).w
h = Planet(p1).h
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Make sure planet isn't going off the screen
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
' Set the Planet as used and save the location
' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
PlanetView(1) = p1
'ELSE
' PlanetView(3) = p1
Planet(p1).x = 800 + x1
Planet(p1).y = y1
Planet(p1).used = 1
Planet
(p1
).spin
= INT(2 * RND)
tag2:
w = Planet(p2).w
h = Planet(p2).h
IF w
< Planet
(p1
).w
AND h
< Planet
(p1
).h
THEN
PlanetView(2) = p2
'ELSE
' PlanetView(4) = p2
Planet(p2).x = 800 + x2
Planet(p2).y = y2
Planet(p2).used = 1
Planet
(p2
).spin
= INT(2 * RND)
'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
Planet(p).c = Planet(p).c + 1
Planet(p).c = 0
Planet(p).r = Planet(p).r + 1
IF Planet
(p
).r
> 3 THEN Planet
(p
).r
= 0
x1 = x1 - warpSpeed
Planet(p).x = x1
PlanetView(v) = 0
Planet(p).used = 0
frameCount = frameCount + 1
frameRate = frameCount
frameCount = 0
'from p5js.bas
FUNCTION map!
(value!
, minRange!
, maxRange!
, newMinRange!
, newMaxRange!
) map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!