Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GOLDEN WAVES (repost and modified)
#1
 THE SIXTH FORM OF GOLDEN WAVES (repost and modified)

                   
click image to zoom in

 CONTROL KEYS :
 ESC        = quit
 UP, DOWN    = amplitudo value,0-100
 LEFT,RIGHT  = chaos value,0-2

 PRESET FORMS : (Press 1-5)
  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 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
                       
    for y1 = 0 to 24
        for x1 = 0 to 24

            'coordinates
            x = (12 * (24 - x1)) + (12 * y1)
            y = (-6 * (24 - x1)) + (6 * y1) + 300
            d = ((10 - x1) ^ 2 + (10 - y1) ^ 2) ^ 0.5

            '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
           
            'ESC to quit
            if keydown(KEY_ESCAPE) end
        next
    next
   
    redraw
    fwait 30
next

loop
Reply
#2
I thought that program looked familiar! Very nice modification. Very cool...
Logic is the beginning of wisdom.
Reply
#3
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.

==============================================================

I am thrilled to announce the game will be available soon. 
The countdown begins! The game is coming soon
Stay tuned for updates!
Reply
#4
The Isometric Alien

Progress so far ...
           
click each image to zoom in

Stay tuned for updates !
Reply
#5
(12-27-2024, 08:54 AM)1micha.elok Wrote: The Isometric Alien

Progress so far ...

click each image to zoom in

Stay tuned for updates !

That looks very interesting Big Grin
Reply
#6
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.

Code:
include "s3d.n7"

set window "pillars", 480*screenw()/screenh(), 480, true
set redraw off

S3D_SetView(primary, rad(60), 0.1, 60)

cube = S3D_BeginMesh()
    S3D_Translate(0, -1, 0)
    S3D_Begin(S3D_QUADS)
        S3D_Color(0, 0, 0)
        S3D_Vertex(1, 1, -1, 0, 0)
        S3D_Vertex(1, 1, 1, 0, 0)
        S3D_Vertex(-1, 1, 1, 0, 0)
        S3D_Vertex(-1, 1, -1, 0, 0)
        S3D_Color(255, 255, 255)
        S3D_Vertex(1, -1, 1, 0, 0)
        S3D_Vertex(1, -1, -1, 0, 0)    
        S3D_Vertex(-1, -1, -1, 0, 0)
        S3D_Vertex(-1, -1, 1, 0, 0)
        S3D_Color(64, 64, 64)
        S3D_Vertex(1, 1, 1, 0, 0)
        S3D_Vertex(1, -1, 1, 0, 0)
        S3D_Vertex(-1, -1, 1, 0, 0)
        S3D_Vertex(-1, 1, 1, 0, 0)
        S3D_Color(204, 204, 204)
        S3D_Vertex(1, -1, -1, 0, 0)
        S3D_Vertex(1, 1, -1, 0, 0)
        S3D_Vertex(-1, 1, -1, 0, 0)
        S3D_Vertex(-1, -1, -1, 0, 0)
        S3D_Color(128, 128, 128)
        S3D_Vertex(-1, 1, 1, 0, 0)
        S3D_Vertex(-1, -1, 1, 0, 0)
        S3D_Vertex(-1, -1, -1, 0, 0)
        S3D_Vertex(-1, 1, -1, 0, 0)
        S3D_Color(128, 128, 128)
        S3D_Vertex(1, 1, -1, 0, 0)
        S3D_Vertex(1, -1, -1, 0, 0)
        S3D_Vertex(1, -1, 1, 0, 0)
        S3D_Vertex(1, 1, 1, 0, 0)
    S3D_End()            
S3D_EndMesh()

visible vLastTick = 0

angleA = 0
angleB = 0
angleC = 0
res = 25

while not keydown(KEY_ESCAPE, true)
    dt = DeltaTime()
    angleA = (angleA + 90*dt)%360
    angleB = (angleB + 140*dt)%360
    angleC = (angleC + 20*dt)%360
    S3D_Clear()
    S3D_RotateZ(sin(rad(angleC)*2)*0.5)
    S3D_RotateX(rad(45))
    S3D_Translate(0, 22, res*1.5)
    S3D_RotateY(rad(45 + angleC))
    for z = 0 to res - 1
        for x = 0 to res - 1
            s = (1 + sin(rad(angleA + x*10))) + (1.5 + 1.5*cos(rad(angleB + z*15)))
            dx = x - res/2 + 0.5
            dz = z - res/2 + 0.5
            S3D_Push()
            S3D_Translate(dx*3, 0, dz*3)
            S3D_Scale(1, s, 1)
            S3D_Mesh(cube, 0)
            S3D_Pop()
        next
    next
    S3D_Render()
    S3D_RenderFog(128, 128, 128, false)
    redraw
    wait 1
wend

function DeltaTime()
    t = clock()
    dt = (min(t - vLastTick, 100))/1000
    vLastTick = t
    return dt
endfunc
Reply
#7
(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  Big Grin

One of the idea is to have an "ommatidia" ... hmm....still thinking, if it's possible ......
Code:
sprite[1] =
    [
    [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
    [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1],
    [1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],
    [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1],
    [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0],
    [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0],
    [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0]
    ]

.....

'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
Reply
#8
THE ISOMETRIC ALIEN

   
click the image to zoom-in

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.

Big Grin

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()

' Include sound fx library.
include "sfx.n7"

' Create an sfx instance.
sfx = SFX()
sfx.SetSampleRate(16000)
sfx.SetEcho(2, 0.4, 0.1, 0)
crispSound = sfx.SquareWave(0.5, [50, 100, -500, 1000], [0.5, 1, 0])
boomSound = sfx.Noise(0.6, [5000, 100], [1, 0, 1, 0])
visible expSound = CreateSineSfx(0.2,1150,600,0.9,11025)

'pattern
sprite =[]
sprite[1] =
    [
    [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
    [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1],
    [1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],
    [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1],
    [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0],
    [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0],
    [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0]
    ]
       
sprite[2] =
    [
    [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
    [1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1],
    [1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1],
    [1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1],
    [1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1],
    [1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1],
    [1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1],
    [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
    [0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0],
    [0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0],
    [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],
    [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
    [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],
    [0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0]
    ]
       
sprite[3] =
    [
    [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0],
    [0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0],
    [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0],
    [0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0],
    [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
    [0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0],
    [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1],
    [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
    [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0],
    [0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0]
    ]

sprite[4] =       
    [
    [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
    [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1],
    [1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1],
    [1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1],
    [1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1],
    [1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1],
    [0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0],
    [0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0],
    [0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0],
    [0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0],
    [0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0],
    [1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1],
    [1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1],
    [0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0]
    ]

rock = []   
rock[1] =
    [
    [1, 1],
    [1, 1]
    ]   
 

'color definition
visible white       = [255,255,255]
visible black       = [0,0,0]
visible topcolor    = [130,130,130]
visible leftcolor   = [60,60,60]
visible rightcolor  = [150,150,150]

'initial value
visible platformSize = 30                   'isometric platform size   
gameSpeed = 1 ; prevTime = clock()          'to be used with delta time
offX = 2        ; offY = 4 ; h = 20         'offY -2,15, h=height of sprite
offRockX = 29 ; offRockY = rnd(-2,27)       'offRockX -5,29 , offRockY -2,27
offRockX2 = 29 ; offRockY2 = 20     
score = 0 ; life = 3 ; endgame = false
pet = rnd(1,4) ; rp = 0 ; gp = 0 ; bp = 60         'number of pet and rgb color

'introduction scene
visible objects = []
visible bigObject = []
visible count = 0
visible start = false
Intro(sprite[rnd(1,4)])
ShakeIt(sprite[1],rp,gp,bp)
play sound crispSound


'-----------
' 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
                   
            'reinitialize
            objects = []
            bigObject = [] 
            count = 0
            start = false
            play sound crispSound
            Intro(sprite[pet])
       
            offRockX = 29
            offRockY = rnd(-2,27)

            h = h-5
            life = life - 1

            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
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    'ESC to quit
    if keydown(KEY_ESCAPE) end
   
    redraw
    fwait 30

until endgame
end


'-----------
' FUNCTIONS
'-----------
function OmmaX(x1,y1)
    return (12 * (24 - x1)) + (12 * y1)+ width()/8
endfunc

function OmmaY(x1,y1)
    return (-6 * (24 - x1)) + (6 * y1) + height()/2
endfunc

'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

    '--------------Methods--------------------
    e.GetShape = function(); return this.shape;   endfunc
    e.PieceX = function(x);  return this.x + x;   endfunc
    e.PieceY = function(y);  return this.y + y;   endfunc

    e.SetDirection = function() 'big shape moves horizontally
        this.dx = platformSize
    endfunc

    e.Update = function(dt)

        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
   
    '-------------- Methods -------------------
    e.SetBigObject = function(bigObject, x, y)
        this.bigObject = bigObject
        this.bigX = x
        this.bigY = y
        this.formParam = 0
    endfunc

    e.Update = function(dt)
        ' Update personal position.
        this.dx = this.dx*(1 - dt)
        this.dy = this.dy*(1 - dt)
       
        this.selfX = this.selfX + this.dx*dt
        this.selfY = this.selfY + this.dy*dt
       
        ' 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   
                                                                                                                                                                                                                       
endfunc


Attached Files
.zip   isometric.zip (Size: 4.83 KB / Downloads: 5)
Reply
#9
Cool concept. Of course my ability to survive was laughable but still a very cool game! Well done!
Logic is the beginning of wisdom.
Reply
#10
Very interesting game idea but also vert difficult Big Grin  Well done! And it looks awesome!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)