Author Topic: Sunbeams  (Read 2261 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Sunbeams
« on: October 01, 2011, 02:05:41 AM »
Hi Charles,

It is early in the morning, here in Germany and I am seeing  the sun with  its belles brilliance.
I do not know why this not happens  in Wales. I guess  there are too many Ufos and the sun is not visible.

Here is  an aternative.

Code: [Select]
indexBase 0
include "window.h"

SetWindow "Early morning light",640,480,w_1
sys_mode=4

int x, y, color= 0xffffff)

While WinExit=0
For y=0 To height-20 step 10
 For x=0 To 20 width-20 Step 10
  Box x,y,4,4,color
  Line x,y,240,69,1,Rgb(Rand(64,255),Rand(64,255),Rand(64,255))
 Next
Next
DoEvents
SwapBuffers
FrameRate 24
Wend
WinEnd
 

Peter

  • Guest
Re: Sunbeams
« Reply #1 on: October 01, 2011, 05:38:38 AM »
more nonsense by Peter.

Code: [Select]
indexBase 0
include "window.h"

% Blue  = 0xFF0000
% Red   = 0x0000FF
% Green = 0x00FF00
% White = 0xffffff

SetWindow "SpeedBalls",320,200,w_2
sys_mode=4

single y1, y2, y3, angle
single os=60, sc=40, spd= 0.05

While WinExit=0
cls 0
y1 = os + sin(angle) * sc
y2 = os + sin(angle + 0.4) * sc
y3 = os + sin(angle + 0.8) * sc
Oval  80, y1, 42, 42, white
Oval 120, y2, 42, 42, white
oval 160, y3, 42, 42, white
angle += spd
DoEvents
SwapBuffers
FrameRate 60
Wend
WinEnd

Code: [Select]
indexBase 0
include "window.h"

% Pink = 0xC0CBFF
% Gold = 0x00D7FF
% Silv = 0xC0C0C0
% Crim = 0x3C14DC
% Moca = 0xB5F4FF
% Medi = 0x71B33C
% Cyan = 0xFFFF00
% Deep = 0xEBCE87
% Aqua = 0xD4FF7F
% stel = 0xB48246
% rose = 0xE1E4FF
% Lava = 0xF5F0FF
% Azur = 0xFFFFF0
% Peru = 0x3F85D8
% Roon = 0x000080
% Ivor = 0xF0FFFF
% Boro = 0xDCDCDC
% Corn = 0xEd9564

SetWindow "Lines",214,194,w_2
SetFont 12,24,0,""
sys i

Dim col[10] as sys
col[01] = pink
col[02] = silv
col[03] = crim
col[04] = moca
col[05] = medi
col[06] = cyan
col[07] = rose
col[08] = corn
col[09] = lava
col[10] = deep

While WinExit=0
For i=1 To 10
Line 20,i*15,180,i*15,i,col[i]
Next
DoEvents
SwapBuffers
Wend
WinEnd
« Last Edit: October 01, 2011, 05:59:02 AM by peter »

Charles Pegge

  • Guest
Re: Sunbeams
« Reply #2 on: October 03, 2011, 10:22:18 AM »

A simple program for training astronauts in the art of putting a spaceship into a close stable orbit.

The only controls available are Acceleration (up arrow key) and deceleration (down arrow key), so timing and duration are critical for setting up a stable orbit.

Charles

Uses Peter's Window.h

Charles



« Last Edit: October 03, 2011, 10:33:59 AM by Charles Pegge »

Peter

  • Guest
Re: Sunbeams
« Reply #3 on: October 03, 2011, 11:41:17 AM »
Hi Charles,

Super program.
I landed three times on the red Planet and was not attacked by the Alien.
This program is really easy to understand, we should have more of it.

Thank you.   

Charles Pegge

  • Guest
Re: Sunbeams
« Reply #4 on: October 03, 2011, 03:47:07 PM »

There is something not quite right about my orbital / gravitation algorithm. Essentially gravitational force is proportional to 1/distance^2. This force has to be resolved into x and y force, then applied to the x and y speed.

Anyway it could make space travel more interesting, especially through the asteroid belt :)

Charles