I doing Twister Demo but cant get two Twister on the screen...
+ Code Snippet// Initialize display
SetVirtualResolution (800,600)
SetClearColor (0,0,0)
SetOrientationAllowed (0,0,1,1)
SetResolutionMode (2)
SetSyncRate (60,1)
SetBorderColor (200,200,200)
Global a#
Global x1#
Global x2#
Global x3#
Global x4#
Global ang#=0
Global amp=7
global Pos1=175
global Pos2=375
// Initialize "bitmap"
global dim pixel[359,299]
for l1=0 to 359
for l2=0 to 299
pixel[l1,l2]=createsprite(void)
setspritesize(pixel[l1,l2],1,-1)
setspriteposition(pixel[l1,l2],l1,l2)
setspritecolor(pixel[l1,l2],random(0,150),random(0,150),random(0,150),255)
next l2
next l1
// Display help
print("Press Q to exit program")
print("Press C to clear screen")
sync()
sleep(1000)
// Main loop (Press Q to exit, C to clear screed)
do
For a=1 To 600 Step 2
x1=((Sin((a/amp)+ang))*100)+300
x2=((Sin((a/amp)+ang+90))*100)+300
x3=((Sin((a/amp)+ang+90*2))*100)+300
x4=((Sin((a/amp)+ang+90*3))*100)+300
If x1<x2
drawline (x1-Pos1,a,x2-Pos1,a,255,0,255)
drawline (x1+Pos2,a,x2+Pos2,a,255,0,255)
EndIf
If x2<x3
drawline (x2-Pos1,a,x3-Pos1,a,0,0,255)
drawline (x2+Pos2,a,x3+Pos2,a,0,0,255)
EndIf
If x3<x4
drawline (x3-Pos1,a,x4-Pos1,a,0,255,0)
drawline(x3+Pos2,a,x4+Pos2,a,0,255,0)
EndIf
If x4<x1
drawline(x4-Pos1,a,x1-Pos1,a,255,255,0)
drawline(x4+pos2,a,x1+pos2,a,255,255,0)
EndIf
Next
ang=ang+2
If ang=360 Then ang=0
// Check for input
if getrawkeypressed(67) then cls(0,0,0)
if getrawkeypressed(81) then exit
sync()
loop
// Safe exit in case of loop exit
end
function cls(r,g,b)
for l1=0 to 359
for l2=0 to 299
plot(l1,l2,r,g,b)
next l2
next l1
endfunction
function plot(x,y,r,g,b)
if x<0 or x>359 or y<0 or y>299 then return
setspritecolor(pixel[x,y],r,g,b,255)
endfunction
function drawline(x1,y1,x2,y2,r,g,b)
dx=abs(x2-x1)
dy=abs(y2-y1)
if x1<x2 then sx=1 else sx=-1
if y1<y2 then sy=1 else sy=-1
err=dx-dy
do
plot(x1,y1,r,g,b)
if x1=x2 and y1=y2 then exit
e2=2*err
if e2>-dy
err=err-dy
x1=x1+sx
endif
if e2<dx
err=err+dx
y1=y1+sy
endif
loop
endfunction
It work so well with other programming language and I want to make work on AppGameKit