A
A1:
Code: Select all
Color cbRed
Repeat
Box x,y,30,30
x=x+RightKey()-LeftKey()
y=y+Downkey()-Upkey()
DrawScreen
Forever
Code: Select all
For i = 1 To i + 1
Color 255 * abs(Sin(i Mod 360)), abs(255 * Sin(i Mod 360)), 0
Box 0,0,400,300
DrawScreen
Next i
Code: Select all
Repeat
Color 127.5+(127.5*Sin(Timer()Shr 3)), (Sin(Timer()Shr 3)*127.5)+127.5, 0
Box 180,130,40,40
DrawScreen
Forever
Code: Select all
Repeat
If (Timer() Mod 1000)<500 Then Text 10, 10, "Text!"
DrawScreen
Forever
Code: Select all
Repeat
stri$ = Str(Rand(1, 49)) // Merkkijonon tyhjennys ja ensimmäinen numero
For i = 0 To 5 // Käydään läpi 6 numeroa
While (InStr(stri$, Str(a)) Or a = 0) // Jos numeroa ei ole annettu tai numero löytyy jo merkkijonosta
a = Rand(1, 49) // Arvotaan uusi numero
Wend
stri = stri + " " + a // Kun numero ON saatu lisätään se jonoon
Next i
Print stri // Tulostetaan jono käyttäjälle
Repeat // Odotetaan että käyttäjä painaa enter tai esc (ilman esc ohjelmasta poistuminen hankalaa)
Until (GetKey() = 13 Or KeyDown(1))
Until KeyDown(1) // Kierretään kunnes käyttäjä painaa esc
Code: Select all
main:
Repeat
nimi$=Input("Etunimi? : ")
DrawScreen
Until KeyHit(cbkeyreturn)
CloseInput
Repeat
sukunimi$=Input("Sukunimi? : ")
DrawScreen
Until KeyHit(cbkeyreturn)
CloseInput
nimi=Upper(Mid(nimi,1,1))+Lower(Mid(nimi,2,Len(nimi)-1))
sukunimi=Upper(Mid(sukunimi,1,1))+Lower(Mid(sukunimi,2,Len(sukunimi)-1))
Repeat
Color cborange
Text 0,0,nimi
Color cbpink
Text TextWidth(" "+nimi),0,sukunimi
DrawScreen
Forever
Code: Select all
Repeat
luku=Input("Syötä luku: ")
DrawScreen
Until KeyHit(cbkeyreturn)
arvo=1
For i=1 To luku
arvo=arvo*i
Next i
Print arvo
WaitKey
Code: Select all
SCREEN 800,600
vuoro=0
x=0
y=0
x2=760
y2=560
Repeat
Color 98,235,33
Box 0,0,800,600
Color cbred
Box x,y,40,40
Color cbdarkblue
Box x2,y2,40,40
If Boxoverlap(x,y,40,40,x2,y2,40,40) Then
vuoro = Not vuoro
x=Rand(760) : x2=Rand(760)
y=Rand(560) : y2=Rand(560)
EndIf
Color cbblack
Select vuoro
Case 0
Text ScreenWidth()/2-TextWidth("Jahtaaja: RED"),0,"Jahtaaja: RED"
Case 1
Text ScreenWidth()/2-TextWidth("Jahtaaja: BLUE"),0,"Jahtaaja: BLUE"
EndSelect
x=x+(LeftKey()-RightKey())*-2
y=y+(UpKey()-DownKey())*-2
x2=x2+(KeyDown(cbkeya)-KeyDown(cbkeyd))*-2
y2=y2+(KeyDown(cbkeyw)-KeyDown(cbkeys))*-2
DrawScreen
Forever
Code: Select all
käännös$=""
Main:
Repeat
inputsana$=Input("Syötä käännettävä sana: ")
Text 0,20,"Käännös "+sana$+" - "+käännös$
DrawScreen
Until KeyHit(cbkeyreturn)
CloseInput
sana$=Lower(inputsana)
Select sana
Case "matriculation examination"
käännös$="Ylioppilastutkinto"
Case "vulgarity"
käännös="Rivous"
Case "schedule"
käännös="Aikataulu"
Case "assigment"
käännös="Koulutehtävä"
Default
käännös="???"
EndSelect
Goto main
Code: Select all
SCREEN 800,400
Type Bullet
Field obj
Field nopeus
EndType
base=LoadObject("media/turret.bmp")
pati=LoadObject("media/bigbullet.bmp",180)
cannon=LoadObject("media/cannon.bmp",180)
tatti=LoadObject("media/tatti.bmp")
ScreenPositionObject base,80,384
CloneObjectPosition cannon,base
ShowObject pati,OFF
voima=10
PositionObject tatti,325,Rand(-200,200)
Repeat
Text 0,0,"Voima: "+voima
Box 20,20,voima*2,10
voima=voima+(DownKey()-UpKey())*-2
If voima<1 Then voima=1
If voima>100 Then voima=100
TurnObject cannon,(RightKey()-LeftKey())*-2
If KeyHit(cbkeyreturn) And liikkeessä=False Then
liikkeessä=True
uusi.BULLET = New(BULLET)
uusi\obj=CloneObject(pati)
uusi\nopeus=voima/3+1
CloneObjectOrientation uusi\obj,cannon
CloneObjectPosition uusi\obj,cannon
EndIf
For uusi.BULLET = Each BULLET
If ObjectX(uusi\obj)>400 Or ObjectX(uusi\obj)<-400 Or ObjectY(uusi\obj)>200 Or ObjectY(uusi\obj)<-200 Then
DeleteObject uusi\obj
Delete uusi
liikkeessä=False
Exit
EndIf
If ObjectsOverlap(uusi\obj,tatti) Then
PositionObject tatti,325,Rand(-200,200)
DeleteObject uusi\obj
Delete uusi
liikkeessä=False
Exit
EndIf
MoveObject uusi\obj,uusi\nopeus
Next uusi
DrawScreen
Forever
Code: Select all
aloita=MakeMenuIMG("Aloita")
aloita2=MakemenuHoverIMG("Aloita")
asetukset=MakeMenuIMG("Asetukset")
asetukset2=MakemenuHoverIMG("Asetukset")
Lopeta=MakeMenuIMG("Lopeta")
Lopeta2=MakeMenuHoverIMG("Lopeta")
hiiri=MakeImage(3,3)
Repeat
DrawImage hiiri,MouseX(),MouseY()
DrawImage aloita,20,20
DrawImage asetukset,20,50
DrawImage lopeta,20,80
If ImagesOverlap(hiiri,MouseX(),MouseY(),aloita,20,20) Then
DrawImage aloita2,20,20
If MouseHit(1) Then MakeError "Aloita"
EndIf
If ImagesOverlap(hiiri,MouseX(),MouseY(),asetukset,20,50) Then
DrawImage asetukset2,20,50
If MouseHit(1) Then MakeError "Asetukset"
EndIf
If ImagesOverlap(hiiri,MouseX(),MouseY(),lopeta,20,80) Then
DrawImage lopeta2,20,80
If MouseHit(1) Then MakeError "Lopeta"
EndIf
DrawScreen
Forever
Function MakeMenuIMG(txt$)
Color cbwhite
img=MakeImage(TextWidth(txt)+4,TextHeight(txt)+4)
DrawToImage img
Box 0,0,TextWidth(txt)+4,TextHeight(txt)+4,OFF
Text 2,-2,txt
DrawToScreen
Return img
EndFunction
Function MakeMenuHoverIMG(txt$)
img=MakeImage(TextWidth(txt)+4,TextHeight(txt)+4)
DrawToImage img
Color cbred
Box 0,0,TextWidth(txt)+4,TextHeight(txt)+4
Color cbwhite
Box 0,0,TextWidth(txt)+4,TextHeight(txt)+4,OFF
Text 2,-2,txt
DrawToScreen
Return img
EndFunction
B1:
Code: Select all
main:
Repeat
nimi$=Input("Etunimi? : ")
DrawScreen
Until KeyHit(cbkeyreturn)
CloseInput
Repeat
sukunimi$=Input("Sukunimi? : ")
DrawScreen
Until KeyHit(cbkeyreturn)
CloseInput
nimi=Upper(Mid(nimi,1,1))+Lower(Mid(nimi,2,Len(nimi)-1))
sukunimi=Upper(Mid(sukunimi,1,1))+Lower(Mid(sukunimi,2,Len(sukunimi)-1))
Repeat
Color cborange
Text 0,0,nimi
Color cbpink
Text TextWidth(" "+nimi),0,sukunimi
DrawScreen
Forever
Code: Select all
SCREEN 400,400
img=MakeImage(400,400)
Repeat
DrawImage img,0,0
If MouseDown(1) Then
DrawToImage img
Line x,y,MouseX(),MouseY()
x=MouseX()
y=MouseY()
DrawToScreen
EndIf
DrawScreen
Forever
Code: Select all
SCREEN 300,300
Dim Ruudukko(2,2) As integer, Vuoro As Integer
Repeat
For a = 0 To 2
For i = 0 To 2
Box i * ScreenWidth() / 3, a * ScreenHeight() / 3, ScreenWidth() / 3, ScreenHeight() / 3, 0
If MouseX() > i * ScreenWidth() / 3 And MouseX() < (i + 1) * ScreenWidth() / 3 And MouseY() > a * ScreenHeight() / 3 And MouseY() < (a + 1) * ScreenHeight() / 3 And MouseHit(1) And Ruudukko(i,a) = 0 Then
Ruudukko(i,a) = vuoro + 1
vuoro = Not vuoro
ElseIf ruudukko(i,a) = 1 Then
Ellipse i * ScreenWidth() / 3, a * ScreenHeight() / 3, ScreenWidth() / 3, ScreenHeight() / 3,0
ElseIf ruudukko(i,a) = 2 Then
Line i * ScreenWidth() / 3, a * ScreenHeight() / 3, (i + 1) * ScreenWidth() / 3 , (a + 1) * ScreenHeight() / 3
Line (i + 1) * ScreenWidth() / 3 , a * ScreenHeight() / 3 , i * ScreenWidth() / 3 , (a + 1) * ScreenHeight() / 3
EndIf
If (Ruudukko(a,0) = (Not vuoro) + 1 And Ruudukko(a,1) = (Not vuoro) + 1 And Ruudukko(a,2) = (Not vuoro) + 1) Or (Ruudukko(0,i) = (Not vuoro) + 1 And Ruudukko(1,i) = (Not vuoro) + 1 And Ruudukko(2,i) = (Not vuoro) + 1) Or (Ruudukko(0,0) = (Not vuoro) + 1 And Ruudukko(1,1) = (Not vuoro) + 1 And Ruudukko(2,2) = (Not vuoro) + 1) Or (Ruudukko(2,0) = (Not vuoro) + 1 And Ruudukko(1,1) = (Not vuoro) + 1 And Ruudukko(0,2) = (Not vuoro) + 1) Then MakeError Chr(79 + (Not vuoro) * 9) + " voitti!"
Next i
Next a
DrawScreen
Forever
C1:
Code: Select all
Repeat : Dot x,y : x=x+(LeftKey()-RightKey())*-(Max(KeyDown(cbkeylshift)*4,Max(KeyDown(cbkeyrshift)*4,1))) : y=y+(UpKey()-DownKey())*-(Max(KeyDown(cbkeylshift)*4,Max(KeyDown(cbkeyrshift)*4,1))) : DrawScreen : Forever
Code: Select all
Repeat
If MouseHit(1) Then //Pisteen A asetus
pointAx=MouseX()
pointAy=MouseY()
pointAset=True
EndIf
If MouseHit(2) Then //Pisteen B asetus
pointBx=MouseX()
pointBy=MouseY()
pointBset=True
EndIf
If pointAset And pointBset Then
angle# = GetAngle (pointAx, pointAy, pointBx, pointBy)
normal# = angle# + 90.0
For i=-5 To 5 //yhteensä 11 kun nolla otetaan mukaan
Line pointAx+Cos(normal)*i, pointAy-Sin(normal)*i,pointBx+Cos(normal)*i, pointBy-Sin(normal)*i
Next i
EndIf
DrawScreen
Until EscapeKey()
Code: Select all
Repeat
If MouseHit(1) Then //Pisteen A asetus
pointAx=MouseX()
pointAy=MouseY()
pointAset=True
EndIf
If MouseHit(2) Then //Pisteen B asetus
pointBx=MouseX()
pointBy=MouseY()
pointBset=True
EndIf
If pointAset And pointBset Then
normal# = GetAngle (pointAx, pointAy, pointBx, pointBy)
dis=Distance(pointax,pointay,pointbx,pointby)
For i=0 To dis
Circle pointAx+Cos(normal)*i, pointAy-Sin(normal)*i,11
Next i
EndIf
DrawScreen
Until EscapeKey()