This is a game that I started working on but abandoned because I didn't feel like drawing more enemy sprites (I even stole and NES:ified the two enemies there are from my n6 game Likker). It comes with a level editor.
Cast your minds back to before the arrival of Mario when Dinosaurs walked... Sorry. Too far back...
Back when Naalaa 6 reigned supreme... with its Tile Map editor and Raycaster... from the minds of Allan Alcorn and Nolan Bushnell (1972) came the awe-inspiring spectacle that was to be known as "Pong"... made its way to our monitors in all of its monochromatic glory!! The Naalaa 6 version was produced by none other than Marcus (drum roll) Johansson. (see screen grab)
... do not forget the original N6 code...
Code:
rem ==================================================================
rem Pong, from basicprogramming.org.
rem
rem By Marcus Johansson.
rem ==================================================================
import "Speed.lib"
set window 0, 0, 320, 240, false, 2
set redraw off
July 16, 1973 saw the release of Atari's, Space Race. Designed by Ted Dabney and assisted by Nolan Bushnell and Allan Alcorn on the heels of Pong, that released on November 29 of the previous year... https://en.wikipedia.org/wiki/Space_Race_(video_game)
This is my feeble attempt to recreated the game... It is not exact and is not complete. Complete in the sense that it is playable.
I have used colour... Sorry. The 'classics' were done in black and white. Like the dinosaurs, black and white, have had their day.
The code is not optimized and may contain 'random features'...
Controls are simple. Player 1 uses "A" and "Z". Player 2 uses "Up" and "Down". (Up and down movement "only").
The game: Both players have a limited amount of time to reach the top of the screen as many times as is possible. Colliding with "objects" will send the player back to the bottom of the screen.
The original game needed quarters to replay... My 7 year-old grand daughter would find the game "boring" but back in 1973... this was the next best thing to magic...
Ideas for improvements will of course be appreciated... but this was just a "fun" project and may not go any further. Mainly a "see if I can" type of game. There is no original source code as the game was purely electronic(?).
Here are some spare snowflakes, plenty of them in Sweden!
Something very similar was written in n6 many years ago.
Code:
' Snowflakes
' ----------
include "list.n7"
#win32
constant BG_R = 16, BG_G = 24, BG_B = 64
set window "Snowflakes", 480*screenw()/screenh(), 480, true
set redraw off
snowflakeImage = loadimage("snowflake.png")
stars = List()
for i = 1 to 200 stars.Add([x: rnd()*2 - 1, y: rnd()*2 - 1, z: 0.1 + rnd()*0.9])
set color BG_R, BG_G, BG_B
cls
do
for i = 0 to stars.size - 1
s = stars[i]
s.z = s.z - 0.01
if s.z < 0.1
s.z = s.z + 0.9
s.x = rnd()*2 - 1
s.y = rnd()*2 - 1
endif
next
stars.Sort(function(a, b)
return b.z - a.z
endfunc)
set color BG_R, BG_G, BG_B, 96
cls
wp = width(primary)/2
hp = height(primary)/2
for i = 0 to stars.size - 1
s = stars[i]
x = wp + s.x*wp/s.z*0.75
y = hp + s.y*hp/s.z*0.75
size = 16/s.z
set color BG_R, BG_G, BG_B, s.z*255
DrawScaledImage(snowflakeImage, x - size/2, y - size/2, size, size)
next
fwait 60
redraw
until keydown(KEY_ESCAPE) or mousebutton(0)
function DrawScaledImage(img, x, y, w, h)
du = 1/w
u = 0
for dx = 0 to w - 1
draw vraster img, x + dx, y, y + h - 1, u, 0, u, 1
u = u + du
next
endfunc
Running Dino ( inspired by the Dino in Chrome browser ) in a very very simplified version.
This simplified version is only an animated one.
Here is the structure of the program :
1. Initialization
-load image : ground
-load image : dino
2. Main Program (Looping)
-define ESC key to quit
-moving background
-our main character :-) .... the one and only 'Dino'
It still needs improvement on these features that haven't been implemented yet :
- Animated running dino
- Jump over obstacle / cactus
- Avoid a flying bird
- etc.
You are most welcome if you are interested to improve this very simple 'Running Dino'
It's better to start with a simplified version to understand the logic before making it more sophisticated
Note : this code below has used 'set redraw off' .... 'redraw' to avoid flickering graphics as it was suggested by Marcus on the '1945 simplified' post / thread.
Code:
'INITIALIZATION
set window "Dino Simplified",640,480
set redraw off 'to avoid flickering graphics
load image 1,"data_dino/ground.png" 'length = 2400 px
load image 2,"data_dino/ground.png"
load image 3,"data_dino/dino1.png"
2. Main Program (Looping)
Draw the plane
Define keys : Esc to quit, Left and Right to move the plane
Draw enemies
Bullet is auto shoot
Still have miss lots of features ... somebody please add some code to detect collision between a bullet and an enemy, I am running out of idea on how to code collision detect
'MAIN PROGRAM
do
'SET BACKGROUND
cls
draw image 4,0,0
'THE PLANE
draw image 1,planeX,planeY
'ESC TO QUIT, LEFT AND RIGHT KEYS TO MOVE THE PLANE
if keydown(KEY_ESCAPE) then end
if keydown(KEY_LEFT) then planeX=planeX-speed
if keydown(KEY_RIGHT) then planeX=planeX+speed
'ENEMIES
for x=0 to 2
if enemyY[x]>480 then
enemyX[x]=rnd(640)
enemyY[x]=-rnd(50)
else
enemyY[x]=enemyY[x]+speed
endif
next
for x=0 to 2
draw image 3,enemyX[x],enemyY[x]
next
'BULLET, AUTO SHOOT
if bulletY < 480 then
bulletY = bulletY - speed*3
endif
if bulletY = 100 then
bulletX = planeX+15
bulletY = planeY
endif