LOGS :
- Posted by johnno1956 on the naalaa forum.
"Here is a short graphical demo that started with Basic256, sdlBasic and RCBasiWhy not N7?"
- Modified on Dec 2024 by Micha
Add interactivity
Code:
'=====================================================
' THE SIXTH FORM OF GOLDEN WAVES (repost and modified)
'
' CONTROL KEYS :
' ESC = quit
' UP, DOWN = amplitudo value,0-100
' LEFT,RIGHT = chaos value,0-2
'
' PRESET FORMS :
' 1 = calm
' 2 = ripple
' 3 = shaked
' 4 = disturbed
' 5 = irregular
'
' LOGS :
' - Posted by johnno1956 on the naalaa forum.
' "Here is a short graphical demo that
' started with Basic256, sdlBasic and RCBasic
' Why not N7?"
' - Modified on Dec 2024 by Micha
' Add interactivity
'=====================================================
'set window size
#win32
set window "The 6th Form of Golden Waves", 600, 470
set redraw off
'color definition
black = [0,0,0]
leftgold = [60, 60, 0]
rightgold = [150,150,0]
white = [255,255,255]
'initial value
amplitudo = 0
chaos = 0
name = "calm"
'main loop
do
for t = 10 to 60 step 0.1
'clear screen
set color black; cls
'infobox
set color white
set caret 10,10
wln "Amplitudo = "+amplitudo
wln "Chaos = "+chaos
wln "Name = "+name
'controls
if keydown(KEY_UP,true) then
amplitudo = min(amplitudo+1,100)
name = "custom"
elseif keydown(KEY_DOWN,true) then
amplitudo = max(amplitudo-1,0)
name = "custom"
elseif keydown(KEY_RIGHT,true) then
chaos = min(chaos+0.01,2)
name = "custom"
elseif keydown(KEY_LEFT,true) then
chaos = max(chaos-0.01,0)
name = "custom"
endif
if keydown(KEY_1,true) then
amplitudo = 0
chaos = 0
name = "calm"
elseif keydown(KEY_2,true) then
amplitudo = 3
chaos = 1
name = "ripple"
elseif keydown(KEY_3,true) then
amplitudo = 25
chaos = 0.1
name = "shaked"
elseif keydown(KEY_4,true) then
amplitudo = 60
chaos = 0.3
name = "disturbed"
elseif keydown(KEY_5,true) then
amplitudo = 100
chaos = 2
name = "irregular"
endif
'form/pattern
h = amplitudo*sin(d * chaos + t) + 70
'on top
set color [100 + h, 100 + h, h]
gold = [x, y - h, x + 10, y + 5 -h, x + 20, y - h, x + 10, y - 5 - h]
draw poly gold, 1
'left side
set color leftgold
gold = [x, y - h, x + 10, y + 5 - h, x + 10, y, x, y - 5]
draw poly gold, 1
'right side
set color rightgold
gold = [x + 10, y + 5 - h, x + 10, y, x + 20, y - 5, x + 20, y - h]
draw poly gold, 1
Spread kindness to every creature including an alien during this Christmas !
click the image to zoom-in
============================================================= THE ISOMETRIC ALIEN
Your mission is very simple
Save the cute alien from red bullet
How long can you save the alien ?
Tips :
Avoid the red bullet and wait until it dissapear !!!
CONTROL KEYS
ESC = quit
ENTER = continue
LEFT,RIGHT = alien's movement
DISCLAIMER
This tiny game is a work of fiction.
It is not intended for commercial use and not for sale
No person or entity associated with this game received payment
or anything of value, or entered into any agreement,
in connection with any game assets used in this game.
Names, characters, places, events and incidents
are either the products of the author’s imagination
or used in a fictitious manner.
Any resemblance to actual persons, animals, aliens and creatures,
living or dead, or actual events is purely coincidental.
(12-28-2024, 08:33 AM)Marcus Wrote: I didn't include this with the examples, but here are some similar pillars using s3d. It's actually a port of an n5 thing.
...
Awesome 3d pillars ! I'll learn how to map x,y alien coordinate to this 3d pillars so that I can move around the alien on top of this s3d pillars...I'll meditate it until 2025
One of the idea is to have an "ommatidia" ... hmm....still thinking, if it's possible ......
'Why this function called Ommatidia ?
'The isometric platform consists of many small cells
'It reminds me of insect's compound eyes which are called ommatidia
function Ommatidia(x,y,h,ct,cl,cr)
'on top
set color ct
bar = [x, y - h, x + 10, y + 5 -h, x + 20, y - h, x + 10, y - 5 - h]
draw poly bar, 1
'left side
set color cl
bar = [x, y - h, x + 10, y + 5 - h, x + 10, y, x, y - 5]
draw poly bar, 1
'right side
set color cr
bar = [x + 10, y + 5 - h, x + 10, y, x + 20, y - 5, x + 20, y - h]
draw poly bar, 1
endfunc
Attention, Earthlings!
The wait is OVER! The Isometric Alien has landed, and it's NOT here to probe your cows (this time)!
Prepare your thumbs for intergalactic action as you step into the wobbly, weird world of pet alien.
Available starting TODAY!
So grab your controllers, snacks, and maybe an anti-alien helmet (just in case)
Don’t miss your chance to save the pet alien... or at least look cool trying.
Play now. Conquer later.
Code:
'=============================================================
' THE ISOMETRIC ALIEN PET
' Your mission is very simple
' Save the cute alien pet from red space rocks
'
' CONTROL KEYS :
' - ESC = quit
' - SPACE BAR = continue
' - LEFT,RIGHT = movement
' - 1,2,3,4 = choose your own alien pet
'
' ACKNOWLEDGEMENTS :
' - Sprites of "Attackers, Galaga Style N7" (Marcus)
' - Big object transformed into small pieces (Marcus)
' - Sound samples and sound library (Marcus)
' - The wave was inspired by "Golden Waves N7" (Johnno56)
'
' DISCLAIMER
' This tiny game is a work of fiction.
' It is not intended for commercial use and not for sale
' No person or entity associated with this game received payment
' or anything of value, or entered into any agreement,
' in connection with any game assets used in this game.
' Names, characters, places, events and incidents
' are either the products of the author’s imagination
' or used in a fictitious manner.
' Any resemblance to actual persons, animals, and aliens,
' living or dead, or actual events is purely coincidental.
'
'==============================================================
'set window size
#win32
set window "The Isometric Alien Pet", 800, 500
set redraw off
randomize clock()
'-----------
' MAIN LOOP
'-----------
do
'delta time
t = clock()
dt = (min(t - prevTime, 66))/1000
prevTime = t
dt = dt*gameSpeed
gameSpeed = gameSpeed + dt*0.05
'clear screen
set color black; cls
'infobox
set color white
set caret 10,10
wln "LEFT / RIGHT to move the pet alien"
wln
wln "Score = "+score
wln "Life = "+life
wln "Game Speed = "+int(gameSpeed)
'isometric platform
for x1 = 0 to platformSize
for y1 = 0 to platformSize
Ommatidia(OmmaX(x1,y1),OmmaY(x1,y1),30,topcolor,leftcolor,rightcolor)
next
next
'controls
if keydown(KEY_RIGHT,true) then
offY = min(offY+5,platformSize-15)
elseif keydown(KEY_LEFT,true) then
offY = max(offY-5,-2)
endif
if keydown(KEY_1,true) then
pet = 1
rp = 0
gp = 0
bp = 60
elseif keydown(KEY_2,true) then
pet = 2
rp = 0
gp = 40
bp = 20
elseif keydown(KEY_3,true) then
pet = 3
rp = 60
gp = 30
bp = 0
elseif keydown(KEY_4,true) then
pet = 4
rp = 0
gp = 30
bp = 60
endif
'check for collision detection
if offRockX > -5 then
offRockX = offRockX - 0.1-dt*7
if offRockX <= 10 and offRockY >= offY and offRockY <= offY+13 then
pet = rnd(1,4)
endif
else
play sound expSound,0.5
score = score + 10
offRockX = 29
offRockY = rnd(-2,27)
endif
'Space Rock #2
if offRockX2 > -5 then
offRockX2 = offRockX2- 0.1-dt*7
else
offRockX2 = 29
offRockY2 = 20
endif
'game over
if h <= 1 then
ShakeIt(sprite[pet],rp,gp,bp)
do
play sound boomSound
Message("GAME OVER",0)
Message("Your score "+score,20)
Message("Continue (Y/N) ?",40)
answer = rln(1,TYPE_STRING)
if upper(answer) = "Y" then
endgame = false
life = 4
gameSpeed = 1
h=20
pet = rnd(1,4)
elseif upper(answer) ="N" then
endgame = true
endif
set color black
draw rect 10,10,50,50,true
until upper(answer)="Y" or upper(answer)="N"
endif
'draw spaceDust, rock, rockTrace, and pet alien
spaceDust(gameSpeed+1)
rockTrace(offRockX,offRockY,1) 'vertical trace
Draw(rock[1],offRockX,offRockY,10,60,0,0)
Draw(sprite[pet],offX,offY,h,rp,gp,bp)
if gameSpeed > 2 then
rockTrace(offRockY2,offRockX2,2) 'horizontal trace
Draw(rock[1],offRockY2,offRockX2,10,60,0,0)
endif
if gameSpeed > 3 then
rockTrace(offRockY2-21,offRockX2,2) 'horizontal trace
Draw(rock[1],offRockY2-21,offRockX2,10,60,0,0)
endif
'Why this function called Ommatidia ?
'The isometric platform consists of many small cells
'It reminds me of insect's compound eyes which are called ommatidia
function Ommatidia(x,y,h,ct,cl,cr)
'on top
set color ct
bar = [x, y - h, x + 10, y + 5 -h, x + 20, y - h, x + 10, y - 5 - h]
draw poly bar, 1
'left side
set color cl
bar = [x, y - h, x + 10, y + 5 - h, x + 10, y, x, y - 5]
draw poly bar, 1
'right side
set color cr
bar = [x + 10, y + 5 - h, x + 10, y, x + 20, y - 5, x + 20, y - h]
draw poly bar, 1
endfunc
function Draw(data,offsetX,offsetY,h,r,g,b)
tcolor = [r*2,g*2,b*2]
lcolor = [r,g,b]
rcolor = [r*3,g*3,b*3]
for y = 0 to sizeof(data) - 1 for x = 0 to sizeof(data[0]) - 1
if data[x][y] = 1 and h>0 then
Ommatidia(OmmaX(x+offsetX,y+offsetY),OmmaY(x+offsetX,y+offsetY),h,tcolor,lcolor,rcolor)
endif
next
endfunc
function Message(text,x)
set color white
set caret 10,10+x
wln text
redraw
endfunc
function CreateSineSfx(duration, startFreq, endFreq, fadeOut, sampleRate)
data = []
a = 0
da = 2*PI*startFreq/sampleRate
dda = (2*PI*endFreq/sampleRate - 2*PI*startFreq/sampleRate)/(duration*sampleRate)
vol = 1
fadeOut = fadeOut*duration*sampleRate
fadeOutDelta = 1/(duration*sampleRate - fadeOut)
for i = 0 to duration*sampleRate - 1
data[i] = sin(a)*vol
a = a + da
da = da + dda
if i > fadeOut vol = vol - fadeOutDelta
next
return createsound(data, data, sampleRate)
endfunc
function ShakeIt(s,r,g,b)
for t = 1 to 5
set color black;cls
tc = [130,130,130]
lc = [60,60,60]
rc = [150,150,150]
for y1 = 0 to platformSize
for x1 = 0 to platformSize
h1 = 60 * sin(x1 / 4 + t) + 60
Ommatidia(OmmaX(x1,y1),OmmaY(x1,y1),h1,tc,lc,rc)
next
Draw(s,0,5,5,r,g,b)
spaceDust(1)
next
fwait 10
redraw
next
endfunc
'---------------------------------------------------------------------------
function Intro(data)
' Big Object
bigObject = BigObject(data) 'one object bigObject
' Object Pieces
foreach row in bigObject.GetShape()
foreach piece in row 'see the shape matrix, 1 = true
if piece then
objects[sizeof(objects)] = SmallObject() 'more than one objects[] objects
endif
next
next
do
set color black;cls 'clear screen
start = true
'isometric platform
for x1 = 0 to platformSize
for y1 = 0 to platformSize
Ommatidia(OmmaX(x1,y1),OmmaY(x1,y1),20,topcolor,leftcolor,rightcolor)
next
next
bigObject.Update(0.01)
foreach i in objects 'for every entry in table objects
i.Update(0.01)
i.Draw()
next
'space dust
spaceDust(5)
redraw
fwait 30
until count > 1
endfunc
function BigObject(data)
'-------------Properties -----------------
e = []
e.shape = data
e.x = (platformSize - 1)/2; e.y = 3 'position x,y
e.dx = 0 'movement
e.hasForm = true 'true when shaped by small objects
e.formTimer = 0
if keydown(KEY_SPACE) or start then
this.formTimer = max(this.formTimer - 0.01, 0)
start = true
endif
if this.formTimer=0 or (keydown(KEY_SPACE) and start = false) then
play sound expSound
if this.hasForm
this.hasForm = false
this.formTimer = 0.1
else
this.hasForm = true
this.formTimer = 2
this.ShapeObjects() 'assign position in the shape to objects
endif
endif
' Move inside the platform
if start = true then
this.x = this.x + this.dx*dt
if this.x < 0-2 then
this.dx = |this.dx|
elseif this.x > platformSize-sizeof(this.shape)-1
this.dx = -|this.dx|
count = count + 1
endif
endif
return true
endfunc
e.ShapeObjects = function()
positions = []
for y = 0 to sizeof(this.shape)-1
for x = 0 to sizeof(this.shape)-1
if this.shape[y][x] then 'this shape[y][x] = 1
positions[sizeof(positions)] = [x, y]
endif
next
next
' Assign shape positions to objects.
index = sizeof(positions)-1 'sizeof(positions) = the sum of 1 in the shape matrix
foreach e in objects
e.SetBigObject(this, positions[index][0], positions[index][1])
free key positions, index
index = index - 1
next
endfunc
e.SetDirection()
return e
endfunc
function SmallObject()
'-------------- Properties ---------------
e = []
e.selfX = rnd(platformSize -1) 'position X
e.selfY = rnd(platformSize -1) 'position Y
e.dx = 0 ; e.dy = 0 'movement
e.bigObject = unset 'set when connected to a big Object
' Combine self position with position given by big object.
if this.bigObject
if this.bigObject.hasForm
this.formParam = min(this.formParam + dt,1)
p = this.formParam^2
this.x = this.selfX*(1-p) + this.bigObject.PieceX(this.bigX)*p
this.y = this.selfY*(1-p) + this.bigObject.PieceY(this.bigY)*p
' "explode"
'else
' a = rnd(360)
' this.dx = cos(rad(a))*platformSize
' this.dy = sin(rad(a))*platformSize
'
' this.selfX = this.x; this.selfY = this.y
'
' this.bigObject = unset
endif
' Only use self position.
else
this.x = this.selfX
this.y = this.selfY
endif
endfunc
e.Draw = function()
'color
r = 0 ; g = 0 ; b = 60
ct = [r*2,g*2,b*2]
cl = [r,g,b]
cr = [r*3,g*3,b*3]
'height
h = 10
'draw to isometric platform
Ommatidia(OmmaX(this.y,this.x),OmmaY(this.y,this.x),h,ct,cl,cr)
if not this.bigObject then
Ommatidia(OmmaX(this.y-1,this.x-1),OmmaY(this.y-1,this.x-1),h,ct,cl,cr)
endif
endfunc
return e
endfunc
'---------------------------------------------------------------------------
function spaceDust(n)
for i = 1 to n
r = rnd(255) ; g = rnd(255) ; b = 0
tc = [r*2,g*2,b*2]
lc = [r,g,b]
rc = [r*3,g*3,b*3]
sdx = rnd(platformSize)
sdy = rnd(platformSize)
h = rnd(5,10+n)
Ommatidia(OmmaX(sdx,sdy),OmmaY(sdx,sdy),h,tc,lc,rc)
Ommatidia(OmmaX(sdx-1,sdy),OmmaY(sdx-1,sdy),h,tc,lc,rc)
Ommatidia(OmmaX(sdx-1,sdy-1),OmmaY(sdx-1,sdy-1),h,tc,lc,rc)
Ommatidia(OmmaX(sdx,sdy-1),OmmaY(sdx,sdy-1),h,tc,lc,rc)
next
endfunc
function rockTrace(i,j,type)
h = 10
r = 100; g=40; b=20
ct = [r*2,g*2,b*2]
cl = [r,g,b]
cr = [r*3,g*3,b*3]
'vertical trace
if type = 1 then
for x1 = platformSize-2 to i
y1 = j
Ommatidia(OmmaX(x1,y1),OmmaY(x1,y1),h,ct,cl,cr)
Ommatidia(OmmaX(x1,y1+1),OmmaY(x1,y1+1),h,ct,cl,cr)
next
endif
'lower horizontal trace
if type = 2 then
for y1 = platformSize-2 to j
x1 = i
Ommatidia(OmmaX(x1,y1),OmmaY(x1,y1),h,ct,cl,cr)
Ommatidia(OmmaX(x1+1,y1),OmmaY(x1+1,y1),h,ct,cl,cr)
next
endif