Psuedo 3d
Author |
Message |
petree08
|
Posted: Tue Oct 31, 2006 2:32 pm Post subject: Psuedo 3d |
|
|
This program gives the illusion of 3d . kind of primative but it looks kinda cool
code: |
const NUM_OF_SIDES := 3
const C := 120
const C2 := 2
const CB := 7
const C3 := 10
var X : array 1 .. NUM_OF_SIDES of int
var Y : array 1 .. NUM_OF_SIDES of int
var X2 : array 1 .. NUM_OF_SIDES of int
var Y2 : array 1 .. NUM_OF_SIDES of int
var DIS : int
var Dy : array 1 .. NUM_OF_SIDES of int
var Dx : array 1 .. NUM_OF_SIDES of int
var Xm, Ym, Click : int
var Length : real4
var SlopeX, SlopeY : int
setscreen ("graphics:max,max,nobuttonbar,offscreenonly")
for Index : 1 .. NUM_OF_SIDES
randint (X (Index), 1, maxx)
randint (Y (Index), 1, maxy)
randint (DIS, 50, 150)
X2 (Index) := X (Index) - DIS
Y2 (Index) := Y (Index) - DIS
loop
randint (Dx (Index), -2, 2)
exit when Dx (Index) not= 0
end loop
loop
randint (Dy (Index), -2, 2)
exit when Dy (Index) not= 0
end loop
end for
colorback (CB)
loop
cls
for Index : 1 .. NUM_OF_SIDES
X (Index) := X (Index) + Dx (Index)
Y (Index) := Y (Index) + Dy (Index)
X2 (Index) := X (Index) - DIS
Y2 (Index) := Y (Index) - DIS
if X (Index) > maxx or X (Index) < 1
then
Dx (Index) := - (Dx (Index))
end if
if Y (Index) > maxy or Y (Index) < 1
then
Dy (Index) := - (Dy (Index))
end if
drawpolygon (X, Y, NUM_OF_SIDES, C)
drawpolygon (X2, Y2, NUM_OF_SIDES, C2)
%drawfillpolygon (X2, Y, NUM_OF_SIDES, 10)
drawline (X (Index), Y (Index), X2 (Index), Y2 (Index), C3)
drawoval (X (Index), Y (Index), 10, 10, C2)
drawoval (X2 (Index), Y2 (Index), 10, 10, C3)
end for
View.Update
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonZ
|
Posted: Wed Nov 01, 2006 9:19 pm Post subject: (No subject) |
|
|
ill say not bad, pretty good for the illusion, it looks like its 3d, good job |
|
|
|
|
|
Voltage128
|
Posted: Sat Dec 02, 2006 10:20 pm Post subject: (No subject) |
|
|
very cool illusion of it being 3d. You could try to make it look like the balls bounce off the walls better tho. On the top and right wall it does this well. But on the bottom and left wall it goes past the screen on mine. Other then that good job. |
|
|
|
|
|
Silent Avenger
|
Posted: Sat Dec 02, 2006 10:57 pm Post subject: (No subject) |
|
|
Good job on creating the illusion, nice work. |
|
|
|
|
|
Clayton
|
Posted: Sun Dec 03, 2006 4:34 pm Post subject: (No subject) |
|
|
code: |
var X : array 1 .. NUM_OF_SIDES of int
var Y : array 1 .. NUM_OF_SIDES of int
var X2 : array 1 .. NUM_OF_SIDES of int
var Y2 : array 1 .. NUM_OF_SIDES of int
var Dy : array 1 .. NUM_OF_SIDES of int
var Dx : array 1 .. NUM_OF_SIDES of int
|
This could easily all become a type of its own (via records), check the Turing Walkthrough out for the tutorial on records and types. However, a quick example:
code: |
const NUM_OF_SIDES := 3
type co_ords :
record
x, y, x2, y2, dx, dy : array 1 .. NUM_OF_SIDES of int
end record
var shape : co_ords
|
|
|
|
|
|
|
[Gandalf]
|
Posted: Sun Dec 03, 2006 11:56 pm Post subject: (No subject) |
|
|
Or better yet:
code: | const NUM_OF_SIDES := 3
var shape : array 1 .. NUM_OF_SIDES of
record
x1, y1, x2, y2, dx, dy : int
end record |
Judging from your code, you should also take a look at the Turing Style Guidelines. |
|
|
|
|
|
|
|