Author Topic: asm demos  (Read 1711 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
asm demos
« on: April 12, 2018, 01:28:17 PM »
Hi,
some new asm demo's

text particles
Code: [Select]
include "asm.inc"
window 400,400,1
SetFrames(60)

sys ma=9600, t=220
float p0[9600]
float p1[9600]
float p2[9600]
float p3[9600]
float p4[9600]
float p5[9600]

cls 0,0,0
color 255,255,0
Text 60,100,10,"I LIKE SPINACH AND POTATOES"

color 64,64,64
FillBox 132,172,86,36
color 128,128,128
FillBox 135,175,80,30
color 0,0,0
Text 140,180,10,"Click me!"

for i=0 to ma-1
    p4[i] = -10
next

i =-1
for k=239 to 0 step -1
for j=0 to 39
    i=i+1
    if GetPixel(k+60,j+100) = RGB(255,255,0)
       p0[i] = k
       p1[i] = j
       p2[i] = (Rand(1,400)/100) - 2
       p3[i] = (Rand(1,400)/100) - 2
       p4[i] = 10
       p5[i] = 96-i/100.0
    end if
next
next

while KeyDown(vk_escape)=0
if MouseZone(132,172,132+88,172+38) and mousebutton()=1
   Exit While
end if
Flip
Wait(10)
wend

while key(27)=0
for i=0 to ma-1
if p4[i] >0
   p5[i] = p5[i] - 2
   if p5[i] <0 then
      p0[i] = p0[i]+ p2[i]
      p1[i] = p1[i]+ p3[i]
      p3[i] = p3[i]+ 0.06
      if p1[i] >303 then p3[i] = -p3[i]/3
   end if
   color 255, 255, 0
   DrawPoint p0[i]+60, p1[i]+100,2
end if
next
Flip()
cls 0,0,0
if t>0
   t = t-1
else
   color 255,255,255
   Text 120,200,10,"PRESS ESCAPE KEY"
end if         
wend
winEnd

butterfly
Code: [Select]
include "asm.inc"
window 1024,768,1

float x1=400, y0=300, x2=400, f, z, a

for z=0 to 400000
    f  =  f + 3.0
    x1 = x1 + cos(z*f)
    x2 = x2 - cos(z*f)
    y0 = y0 + sin(z*f)
    color mod(z,255),mod(z,255),mod(z,255)
    SetPixel(x1+100, y0)
    SetPixel(x2+100, y0)
next
color 255,255,255
Text 380,16,20,"BUTTERFLY"
WaitKey
WinEnd

pyramide
Code: [Select]
include "asm.inc"
Window 400,360,1

LineSize (2)
sys ox = screenW/2
sys oy = screenH/2

single alpha, beta=30, t=100
single ax, ay, bx, by, cx, cy, dx, dy

while KeyDown(27)=0
cls 0,0,0
ax = t * cos(rad(alpha))
ay = sin(rad(beta)) * t * sin(rad(alpha))
bx = t * cos(rad((alpha + 90) % 360))
by = sin(rad(beta)) * t * sin(rad((alpha + 90) % 360))
cx = t * cos(rad((alpha + 180) % 360))
cy = sin(rad(beta)) * t * sin(rad((alpha + 180) % 360))
dx = t * cos(rad((alpha + 270) % 360))
dy = sin(rad(beta)) * t * sin(rad((alpha + 270) % 360))
color 255,255,255
Line ox, oy-120, ox+ax, oy-ay
Line ox, oy-120, ox+bx, oy-by
Line ox, oy-120, ox+cx, oy-cy
Line ox, oy-120, ox+dx, oy-dy
Line ox+ax,oy-ay,ox+bx, oy-by
Line ox+bx,oy-by,ox+cx, oy-cy
Line ox+cx,oy-cy,ox+dx, oy-dy
Line ox+dx,oy-dy,ox+ax, oy-ay
Flip
Wait 10   
alpha +=1
wend
WinEnd

fake
Code: [Select]
include "asm.inc"
window 800,800,1
SetFrames (40)
CenterMousePos()

Function Distance(sys x1,y1,x2,y2) as sys
sys dx, dy
dx = x1-x2
dy = y1-y2
Return Sqr(dx*dx+dy*dy)
End Function

w = ScreenW
h = ScreenH
single maxdist,s,a
maxdist = Distance 0,0,w/2,h/2

while KeyDown(27)=0
cls 32,32,32
for i=0 to w step 4
for j=0 to h step 4
    s = (Distance xMouse,yMouse,i,j)/maxdist*30
    color mod(i,255),mod(j,255),mod(i,255)
    DrawPoint i,j, sin(s-a)*2
next
next 

a +=1
if a>=360 then a=-a
Flip()
Wait (20)
wend
WinEnd


jack

  • Guest
Re: asm demos
« Reply #1 on: April 13, 2018, 03:06:05 AM »
thank you Peter :)