Login Register
Frontpage Code library Pastebin

Lötköpötköt

Author: KilledWhale
Added: 9. huhtikuuta 2011 kello 21.22
Edited: 15. huhtikuuta 2011 kello 22.19
Category: Efektit

Description

'09 Assyilla tehdyt putket. Melko yleinen demoefekti.

Code

Select all
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Classical effect made with CoolBasic @ Assembly 2009

SCREEN 800, 600

Dim ord(6, 3)

ord(1, 1) = 1 : ord(1, 2) = 2 : ord(1, 3) = 3
ord(2, 1) = 1 : ord(2, 2) = 3 : ord(2, 3) = 2
ord(3, 1) = 2 : ord(3, 2) = 1 : ord(3, 3) = 3
ord(4, 1) = 2 : ord(4, 2) = 3 : ord(4, 3) = 1
ord(5, 1) = 3 : ord(5, 2) = 1 : ord(5, 3) = 2
ord(6, 1) = 3 : ord(6, 2) = 2 : ord(6, 3) = 1

img = MakeImage(100, 600)
DrawToImage img
	For y = 0 To 61
		For x = 0 To 18
			a = Abs(5 - x) * 50
			If (x + y) Mod 2 Then
				Color 255 - a, 0, 255 - a
			Else
				Color 0, 0, 0
			EndIf
			Box (x - 1) * 10, y * 10, 10, 10
		Next x
	Next y
DrawToScreen

MaskImage img, 100, 100, 100

Repeat
	angle = WrapAngle(angle + 2)
	ca# = Cos(angle) * 10
	cs# = Sin(angle) * 10
	
	Color 127 + sa * 125, 127 - sa * 125, 0
	For x = 0 To 18
		For y = 0 To 16
			If (x + y) Mod 2 Then Box (x - 1) * 50 + ca, (y - 1) * 50 - cs, 50, 50
		Next y
	Next x
	
	For y = 0 To 150
		y2 = angle + y
		yy = y Shl 2
		
		z1# = Sin(y2)
		z2# = Sin(y2 + 120)
		z3# = Sin(y2 + 240)
	
		If (z1 > z2 And z2 > z3) Then
			order = 1
		ElseIf (z1 > z3 And z3 > z2) Then
			order = 2
		ElseIf (z2 > z1 And z1 > z3) Then
			order = 3
		ElseIf (z2 > z3 And z3 > z1) Then
			order = 4
		ElseIf (z3 > z1 And z1 > z2) Then
			order = 5
		Else
			order = 6
		EndIf
		
		DrawImageBox img, 355 + Sin(y2 + ord(order, 1) * 120) * 100, yy, 0, yy, 90, 4
		DrawImageBox img, 355 + Sin(y2 + ord(order, 2) * 120) * 100, yy, 0, yy, 90, 4
		DrawImageBox img, 355 + Sin(y2 + ord(order, 3) * 120) * 100, yy, 0, yy, 90, 4
	Next y
	Text 0, 0, FPS()

	SetWindow Str(FPS())
	DrawScreen
Forever

Comments

#31 Sent by: Konstaduck, 3. helmikuuta 2012 kello 18.55

Tuo oli kyllä jo melkoisen komea

Leave a comment

You must be logged in to comment.