Pikku pelit

Jaa meneillään olevat projektisi tai valmiit pelit muun yhteisön kanssa täällä.
Post Reply
kemp250
Newcomer
Posts: 24
Joined: Fri Nov 14, 2008 5:39 pm
Location: En voi kertoa. He voivat kuunnella meitä.

Re: Pikku pelit

Post by kemp250 »

Tein tällaisen pikku "jääkiekkomaalivahtipelin". Tarkoituksena on onnistua torjumaan mahdollisimman monta "kiekkoa" sinisellä laatikolla. Peli loppuu kun kiekko pääsee ohitsesi maaliin.

Code: Select all

A=0

x = 200
y = 250

y2 = Rand(120, 280)

B4 = 2.0


startnp1:

x2=0

Repeat

SetWindow "Jääkiekkopeli. Pisteesi=" +A,0,"haluatko lopettaa?"

Color cbred
Text 100,20,"punainen: jääkiekko"
Color cbblue
Text 100,60,"sininen: maalivahti (sinä)"
Color cbyellow
Text 100,100,"keltainen: maali"


 
Color cbblue
Box x,y,13,10
Color cbred
Box y2,x2,10,10
Color cbyellow
Box 120,270,160,1

    If LeftKey()Then x=x-2
    If RightKey()Then x=x+2



If BoxOverlap (x,y,10,10,y2,x2,45,10)Then A=A+1
If BoxOverlap (x,y,10,10,y2,x2,45,10)Then B4=B4+0.6
If BoxOverlap (x,y,10,10,y2,x2,45,10)Then Goto randagain
If BoxOverlap (y2,x2,15,10,120,270,160,1)Then MakeError "Kiekko pääsi maaliin. Pisteesi: "+A

x2=x2+B4
B4=B4-0.49

If B4>4 Then B4=3.5

DrawScreen

Forever

randagain:

x2 = 200
y2 = 1650

y2 = Rand(120, 280)
Goto startnp1
Minun ennätykseni: 52
"Working" for GameTailors.

Projektit:
Tower Climber, 23%
Avaruusjalkkisjuttu jossa ei ole jalkoja eikä palloja, 19%

I have been using coolbasic many years. I just fail a lot.
nevssons
Devoted Member
Posts: 503
Joined: Sun Jan 13, 2008 5:02 pm

Re: Pikku pelit

Post by nevssons »

DatsuniG wrote:Nyt on lisätty uusi ase sekä muutettu vihollisten lisäämistä.

Code: Select all

koodia
EDIT:

Onhan se vähän ylivoimainen : D Ja nyt niitä kommentteja prkl!

Milloin ase vaihtuu? 126 tappoa ja yhä pistooli
MikkoK
Devoted Member
Posts: 813
Joined: Thu Jun 05, 2008 2:13 pm
Location: City 17

Re: Pikku pelit

Post by MikkoK »

nevssons wrote:
DatsuniG wrote:Nyt on lisätty uusi ase sekä muutettu vihollisten lisäämistä.

Code: Select all

koodia
EDIT:

Onhan se vähän ylivoimainen : D Ja nyt niitä kommentteja prkl!

Milloin ase vaihtuu? 126 tappoa ja yhä pistooli
Käytä hiiren rullaa. :D

Code: Select all

#aha. @ IRCNet
<Grandi> Voit laittaa jo valmiiks hailaittiin "Amis-Mikko", koska alan kutsua sua sillä nimellä.
phons
Guru
Posts: 1056
Joined: Wed May 14, 2008 10:11 am

Re: Pikku pelit

Post by phons »

Tuohon peliin liittyen: Tapot 1874 kun kuolin :D Jos pelissä olisi arvonimet tappojen perusteella olisinko "Guru"?
Edit: ton vedin ekalla...
Last edited by phons on Sun Feb 08, 2009 9:03 pm, edited 1 time in total.
Image
Jani
Devoted Member
Posts: 741
Joined: Fri Oct 31, 2008 4:53 pm

Re: Pikku pelit

Post by Jani »

phons wrote:Tuohon peliin liittyen: Tapot 1874 kun kuolin :D Jos pelissä olisi arvonimet tappojen perusteella olisinko "Guru"?
Oma ennätys oli 8274 :P
Tosin vasta kolmannella kerralla.
Bugi?
Dead men tell no tales. Also, Python rocks!
Codegolf: 99 bottles of beer (oneliner) - Water map partition
DatsuniG
Advanced Member
Posts: 367
Joined: Fri Aug 15, 2008 9:57 pm

Re: Pikku pelit

Post by DatsuniG »

Vihollisten lisäys on tehty niin huonosti että voi saada melkein niin paljon tappoja kuin haluaa : ]
Hengität nyt manuaalisesti.
nevssons
Devoted Member
Posts: 503
Joined: Sun Jan 13, 2008 5:02 pm

Re: Pikku pelit

Post by nevssons »

DatsuniG wrote:Vihollisten lisäys on tehty niin huonosti että voi saada melkein niin paljon tappoja kuin haluaa : ]
Niinhän siinä saa! 1567 tapon jälkeen kyllästyin ja lopetin
Koodarina kohtalainen, henkilönä vittumainen
Image
Pauli-
Newcomer
Posts: 5
Joined: Sun Mar 02, 2008 5:45 pm

Re: Pikku pelit

Post by Pauli- »

Tein tälläsen pienen lehmän ammunta pelin ;)
Eli ideana on yksinkertaisesti ampua vastaan tulevat lehmät ja saada siten pisteitä
Jokaisesta osutusta lehmästä niiden nopeus nousee hieman

Oma enkka on jotain 680
Attachments
CowShooter.zip
Cowshooter
(995.24 KiB) Downloaded 289 times
Character
Active Member
Posts: 113
Joined: Thu Nov 27, 2008 2:16 pm

Re: Pikku pelit

Post by Character »

Aloin eilen väsäämään Pacman -kloonia. En jaksanutkaan viedä projektia pitemmälle ja
projekti jäätyi. Tässä kuitenkin se mitä sain aikaan: klik! Tekoälyyn olen varsin
tyytyväinen. Sorry huonot grafiikat :mrgreen:
Pihatonttu
Newcomer
Posts: 10
Joined: Sun Feb 15, 2009 9:56 pm
Location: Suomessaha mie asun

Re: Pikku pelit

Post by Pihatonttu »

tässä on mun teksti peli jos löytyy virheitä nii sanokaa :D

Code: Select all

'TEKSTIPELI
'---------------------------
alku:
ClearText
ClearKeys
CloseInput

AddText "mitä haluat tehä?"
AddText ""
AddText "1. mennä ulos"
AddText "2. mennä kalaa"
AddText "3. syödä jotain"
AddText "4. mennä nukkuu"
AddText "5. istua niin kauan että kuolen nälkää"
AddText ""

AddText "ei asiaan liittyvä asia"
AddText "vaan apuja mitä voitte lähettää yksityisesti"
AddText "en saa toimii videoit tulee"
AddText "memory access violation"

Repeat

    c=Input("?")
    
    DrawScreen
   
Until KeyHit(cbkeyreturn)

Select c
    Case 1
        Goto ulos
    Case 2
        Goto kalaa
    Case 3
        Goto syödä
    Case 4
        Goto nukkuu
    Case 5
        Goto kuolema
    Default
        AddText "hyvä valinta"
        DrawScreen
        Wait 2000
        GoTo alku
End Select
       
'---------------------------------------

ulos:
ClearText
ClearKeys
CloseInput

AddText "nonii, olet nyt ulkona mitä haluat tehdä?"
AddText ""
AddText "1. takaisin sisälle"
AddText "2. kalaan"
AddText "3. tappaa itseni"
AddText ""

Repeat

    c=Input("?")
   
    DrawScreen
   
Until KeyHit(cbkeyreturn)

Select c
    Case 1
        Goto alku
    Case 2
        Goto kalaa
    Case 3
        Goto tappaa
    Default
        AddText "niin sitä pitää"
        DrawScreen
        Wait 2000
        Goto ulos
End Select

'---------------------------------------

kalaa:
ClearText
ClearKeys
CloseInput

AddText "sait kymmenen taimenta ."
AddText "yhden kalan sisällä oli kirje jossa lukee jotain!"
AddText "mutta mitä??"

DrawScreen
Wait 10000

Goto voitto

'---------------------------------------

syödä:
ClearText
ClearKeys
CloseInput

AddText "nami..tosi hyvää saako lisää?"
AddText "ei tosi"

DrawScreen
Wait 3000

Goto alku

'---------------------------------------

nukkuu:
ClearText
ClearKeys
CloseInput

AddText "krooh pyyh krooh...."
AddText "mitä mitä onko jo aamu?"

DrawScreen
Wait 3000

Goto alku

'---------------------------------------

tappaa:
ClearText
ClearKeys
CloseInput

AddText "minä tapan itseni arrrrgg!!"
AddText "nyt se on menoo"

DrawScreen
Wait 3000

Goto loppu

'---------------------------------------

loppu:
ClearText
ClearKeys
CloseInput

addtext "FAILED"

ClearKeys
CloseInput

AddText "voit sentää kokeilla uuestaa :D"
AddText ""
AddText "1. yritä uudestaan"
AddText "2. lopeta"
AddText ""

Repeat

    c=Input("?")
   
    DrawScreen
   
Until KeyHit(cbkeyreturn)

Select c
    Case 1
        Goto alku
    Case 2
        Goto lopetus
End Select
   
'---------------------------------------

voitto:
ClearText
ClearKeys
CloseInput

AddText "VOITIT, SIIS TAJUUTKO VOITIT"

AddText "jos haluut nii kokeile uuestaa eri taval :D"
AddText ""
AddText "1. yritä uudestaan"
AddText "2. lopeta"
AddText ""



Repeat

    c=Input("?")
   
    DrawScreen
   
Until KeyHit(cbkeyreturn)

Select c
    Case 1
        Goto alku
    Case 2
        Goto lopetus
End Select
'--------------------------------------
lopetus:
ClearText
ClearKeys
CloseInput

AddText "nyt se sitte loppuu"

DrawScreen
Wait 3000
End 

'-----------------------------------------
kuolema:
ClearText
ClearKeys
CloseInput

AddText "tunnit kuluu nälkä tulee ja jano"
AddText "nälkä, nälkä pois, nälkä, nälkä pois"
AddText "taian kuolla"
AddText "mutta voit lopettaa sen"


AddText ""
AddText "1. juomalla"
AddText "2. tappamalla itsesi puukolla"
AddText "3. tappamalla itsesi sinkolla"
AddText "4. tai syömällä"
AddText "5. tai jatkamalla tekemättä mitään"
AddText ""

Repeat 

c=Input("?")

DrawScreen

Until KeyHit(cbkeyreturn)

Select c
    Case 1
        Goto juo
    Case 2
        Goto puukko
    Case 3
        Goto sinko
    Case 4
        Goto syödä
    Case 5
        Goto lopetus
End Select 

'------------------------------------------------
juo:
ClearText
ClearKeys
CloseInput

AddText ""
AddText "1. cokista"
AddText "2. olutta"
AddText "3. mehua"
AddText ""

Repeat 

c=Input("?")

DrawScreen 

Until KeyHit (cdkeyreturn)

Select c
     Case 1 
         Goto cokis 
     Case 2
         Goto olut
     Case 3
         Goto mehu
End Select          
      
'----------------------------------------------
puukko:
ClearText
ClearKeys
CloseInput         

AddText "mihin haluat puukottaa?"

AddText ""
AddText "1. päähän"
AddText "2. selkä tai maha"
AddText "3. jalkaa"
AddText "4. kätee"
AddText ""

Repeat 

c=Input("?")

DrawScreen 

Until KeyHit (cdkeyreturn)

Select c
     Case 1 
         Goto pää 
     Case 2
         Goto selkä
     Case 3
         Goto jalka
     Case 4
         Goto käsi
End Select     
'-----------------------------------------------
sinko:
ClearText
ClearKeys
CloseInput   

AddText "ai sinko ! omg!!!"
AddText "etkö parempaa pysty haha"

AddText "haluatko kokeilla parempaa"

AddText ""
AddText "1. tankki"
AddText "2. ydinpommi"
AddText "3. en halua parempaa"

Repeat 

c=Input("?")

DrawScreen 

Until KeyHit (cdkeyreturn)

Select c
     Case 1 
         Goto tankki 
     Case 2
         Goto ydin
     Case 3
         Goto ei
End Select 
'------------------------------------------------
cokis:
ClearText
ClearKeys
CloseInput


AddText "kokis nam"
AddText "vielä ruoka nii hyvä hyvä"
AddText ""
AddText "1. ruoka"
AddText " 2. takaisin kotiin"
AddText ""

Repeat 

c=Input("?")

DrawScreen 

Until KeyHit (cdkeyreturn)

Select c
     Case 1 
         Goto syödä
     Case 2
         Goto alku
End Select 
'-------------------------------------------------
olut:
ClearText
ClearKeys
CloseInput

AddText "en mää tätä halunnu mutta menee tääki"

AddText "haluutko juua humalaa?"

AddText ""
AddText "humalaan"
AddText "mennä kotiin"
AddText ""

Repeat

c=Input("?")

DrawScreen 

Until KeyHit (cdkeyreturn)

Select c
     Case 1
         Goto humala
     Case 2
          Goto alku
End Select           
'-------------------------------------------------
mehu:
ClearText
ClearKeys
CloseInput         

AddText "aah.. hyvää "
AddText " voit myös käyä syömäs"

AddText ""
AddText "kotiin"
AddText "vai syömää"
AddText ""

Repeat 

c=Input("?")

DrawScreen

Until KeyHit (cdkeyreturn)

Select c
      Case 1
          Goto alku
      Case 2
          Goto syödä
End Select 

'-----------------------------------------
humala:
ClearText
ClearKeys
CloseInput 

AddText "jaaha.... päässä huippaa"
AddText "kiuvaa jeu"


AddText "sinun jutussasi oli se huono puoli että kuolit :D"

DrawScreen
Wait 10000

Goto lopetus
         
'--------------------------------------------
ydin:
ClearText
ClearKeys
CloseInput

AddText "päätyit ydin pommii, ääk"
AddText "!!!!putum!!!!"

DrawScreen 
Wait 5000

Goto lopetus 

'----------------------------------------------
tankki:
ClearText
ClearKeys
CloseInput

AddText "nyt asiaan"
AddText "tämä loppuu nyt"
AddText "pröö"
AddText "nyt se kuolema tuli"

DrawScreen
Wait 5000

Goto lopetus

'-----------------------------------------------
ei:
ClearText
ClearKeys
CloseInput

AddText "sinkoo jäit"
AddText  "no sama se"
AddText "aika ampua"
AddText "pojojoin"
AddText "tämäkin vei kuolemaan"

Goto  lopetus

'-------------------------------------------------
pää:
ClearText
ClearKeys
CloseInput

AddText "haajaa"
AddText "plyrs"

DrawScreen 
Wait 5000 
Goto lopetus 
'-------------------------------------------------
jalka:
ClearText
ClearKeys
CloseInput

AddText "sinjamon"
AddText "plörs"

DrawScreen 
Wait 5000
Goto lopetus
'------------------------------------------------
käsi:
ClearText
ClearKeys
CloseInput

AddText "hajaki"
AddText "plump"

DrawScreen 
Wait 5000
Goto lopetus
'-----------------------------------------------
selkä:
ClearText
ClearKeys
CloseInput 

AddText "sinjamoon"
AddText "pump"

DrawScreen 
Wait 5000
Goto lopetus
EDIT:

muokkasin vähä tota ja otin bugin pois siis yhen niitä saattaa olla enemmä 8-)

Last edited by Pihatonttu on Mon Feb 23, 2009 4:09 pm, edited 2 times in total.
Pihatonttu
User avatar
valscion
Moderator
Moderator
Posts: 1599
Joined: Thu Dec 06, 2007 7:46 pm
Location: Espoo
Contact:

Re: Pikku pelit

Post by valscion »

Pihatonttu wrote:tässä on mun teksti peli jos löytyy virheitä nii sanokaa :D
Sulla on kaksi "loppu" nimistä labelia eli kirjanmerkkiä eli hyppäyskohtaa. Saattaapi aiheuttaa outoja virheitä.
Zero @ [url=http://www.coolbasic.com/cbmanual/language/jumps.html]CB manuaali[/url] wrote:Sinulla ei saa olla kahta saman nimistä kirjanmerkkiä (paitsi jos toinen niistä on eri funktiossa).
cbEnchanted, uudelleenkirjoitettu runtime. Uusin versio: 0.4.1 — Nyt myös sorsat GitHubissa!
NetMatch - se kunnon nettimättö-deathmatch! Avoimella lähdekoodilla varustettu
vesalaakso.com
Wingman
Devoted Member
Posts: 594
Joined: Tue Sep 30, 2008 4:30 pm
Location: Ruudun toisella puolella

Re: Pikku pelit

Post by Wingman »

Tässä väsäsin Pongin, ei mikään maailman paras versio... pallo kun liikkuu vain 45 asteen kulmassa...

Napit ovat:
pl1 ylös= ylänuoli
pl1 alas= alanuoli
pl2 ylös= w
pl2 alas= s

menuissa käytetään enteriä ja Q-nappia

eipäs muuta, nauttikaa vihreästä pongista

Code: Select all

SCREEN 680,460,0
kenttä=MakeImage(680,460)
palkkii1=MakeImage(16,64)
palkkii2=MakeImage(16,64)
palloi=MakeImage(16,16)
DrawToImage kenttä
    Color 0,160,0
    Line 340,0,340,460
DrawToImage palkkii1
    Color 0,160,0
    Box 0,0,16,64,0
    Color 1,1,1
    Box 1,1,14,62,1
DrawToImage palkkii2
    Color 0,160,0
    Box 0,0,16,64,0
    Color 1,1,1
    Box 1,1,14,62,1
DrawToImage palloi
    Color 0,160,0
    Circle 0,0,16,0
    Color 1,1,1
    Circle 1,1,14,1
DrawToScreen 
pallo=MakeObject(0)
PaintObject pallo,-palloi
palkki1=MakeObject(0)
palkki2=MakeObject(0)
PaintObject palkki1,-palkkii1
PaintObject palkki2,-palkkii2
PositionObject palkki1,-300,0
PositionObject palkki2,300,0
menu:
PositionObject palkki1,-300,0
PositionObject palkki2,300,0
ballx=5
bally=5
PositionObject palkki1,-300,0
PositionObject palkki2,300,0
PositionObject pallo,0,0
Color 0,160,0
AddText "Enter: Aloita peli"
AddText "Q: Lopeta"
Repeat
    TranslateObject pallo,ballx,bally    
    If ObjectY(palkki1)>198 Then PositionObject palkki1,-300,198
    If ObjectY(palkki1)<-198 Then PositionObject palkki1,-300,-198
    If ObjectY(palkki2)>198 Then PositionObject palkki2,300,198
    If ObjectY(palkki2)<-198 Then PositionObject palkki2,300,-198    
    PositionObject palkki1,-300,ObjectY(pallo)
    PositionObject palkki2,300,ObjectY(pallo)
    DrawImage kenttä,0,0
    If KeyHit(28) Then 
        ClearText
        ClearKeys 
        Goto peli         
    EndIf
    If KeyHit(16) Then
        ClearText 
        ClearKeys 
        Goto lopetus 
    EndIf
        If ObjectY(pallo)>222 Then bally=-5
    If ObjectY(pallo)<-222 Then bally=5
    If ObjectX(pallo)<-332 Then 
        ballx=5
        
    EndIf 
    If ObjectX(pallo)>332 Then 
        ballx=-5
        
    EndIf 
    If ObjectsOverlap(pallo,palkki1,3) Then 
        ballx=5
    EndIf 
    If ObjectsOverlap(pallo,palkki2,3) Then 
        ballx=-5
    EndIf 
    DrawScreen 
Forever

peli:
PositionObject palkki1,-300,0
PositionObject palkki2,300,0
PositionObject pallo,0,0
AddText "3"
DrawScreen 
Wait 1000
ClearText 
ClearKeys
AddText "2"
DrawScreen 
Wait 1000
ClearText 
ClearKeys 
AddText "1"
DrawScreen 
Wait 1000
ClearText 
ClearKeys
AddText "GO!"
DrawScreen 
Wait 1000
ClearText 
ClearKeys 
DrawScreen 
p1score=0
p2score=0
ballx=5
bally=5
Color 0,100,0
AddText "Q: Takaisin menuun"
AddText "Esc: lopeta"
Color 0,160,0
Repeat 
    DrawImage kenttä,0,0
    If KeyDown(200) Then TranslateObject palkki2,0,4
    If KeyDown(208) Then TranslateObject palkki2,0,-4
    If KeyDown(17) Then TranslateObject palkki1,0,4
    If KeyDown(31) Then TranslateObject palkki1,0,-4
    If ObjectY(palkki1)>198 Then PositionObject palkki1,-300,198
    If ObjectY(palkki1)<-198 Then PositionObject palkki1,-300,-198
    If ObjectY(palkki2)>198 Then PositionObject palkki2,300,198
    If ObjectY(palkki2)<-198 Then PositionObject palkki2,300,-198
    Text 320,10,""+p1score
    Text 350,10,""+p2score
    If ObjectY(pallo)>222 Then bally=-5
    If ObjectY(pallo)<-222 Then bally=5
    If ObjectX(pallo)<-332 Then 
        ballx=5
        p2score=p2score+1
    EndIf 
    If ObjectX(pallo)>332 Then 
        ballx=-5
        p1score=p1score+1
    EndIf 
    TranslateObject pallo,ballx,bally
    If ObjectsOverlap(pallo,palkki1,3) Then 
        ballx=5
    EndIf 
    If ObjectsOverlap(pallo,palkki2,3) Then 
        ballx=-5
    EndIf 
    If KeyHit(16) Then 
        ClearText 
        ClearKeys
        Goto menu 
    EndIf 
    DrawScreen 
Until p1score>14 Or p2score>14
Repeat 
    If p1score>14 Then 
        ClearText 
        ClearKeys 
        Goto p1win
    EndIf 
    If p2score>14 Then
        ClearText
        ClearKeys 
        Goto p2win
    EndIf     
Forever 
lopetus:
AddText "Haluatko todella lopettaa?"
AddText "Enter: Kyllä"
AddText "Q: Ei"
Repeat 
    If KeyHit(28) Then 
        End
    EndIf 
    If KeyHit(16) Then
        ClearText 
        ClearKeys 
        Goto menu
    EndIf
    TranslateObject palkki1,0,-15
    TranslateObject palkki2,0,-15
    TranslateObject pallo,0,-15
    DrawScreen 
Forever 
p1win:
AddText "Hienoa pelaaja 1! Voitit!"
AddText "Enter: takaisin menuun"
AddText "Q: lopeta"
Repeat 
    If KeyHit(28) Then 
        ClearText 
        ClearKeys 
        Goto menu
    EndIf 
    If KeyHit(16) Then 
        ClearText 
        ClearKeys 
        End
    EndIf 
    DrawScreen
Forever 
p2win:
AddText "Hienoa pelaaja 2! Voitit!"
AddText "Enter: takaisin menuun"
AddText "Q: lopeta"
Repeat 
    If KeyHit(28) Then 
        ClearText 
        ClearKeys 
        Goto menu
    EndIf 
    If KeyHit(16) Then 
        ClearText 
        ClearKeys 
        End
    EndIf 
    DrawScreen
Forever 
- - - -
Character
Active Member
Posts: 113
Joined: Thu Nov 27, 2008 2:16 pm

Re: Pikku pelit

Post by Character »

BMTronin tapainen matopeli (testausmielessä):

Code: Select all

alku:

Global win

Goto valikko

valikko:

Select win
    Case 0
        txt$ = "paina ENTER"
    Case 1
        txt$ = "Pelaaja 1 voitti! paina ENTER"
    Case 2
        txt$ = "Pelaaja 2 voitti! paina ENTER"
    Case 3
        txt$ = "Tasapeli! paina ENTER"
End Select

Repeat
    
    Color 255, 255, 255
    
    Text ScreenWidth()/2 - TextWidth(txt)/2, ScreenHeight()/2 - TextHeight(txt)/2, txt
    
    If KeyHit(cbkeyReturn) Then Wait 500: Goto peli
    
    DrawScreen
    
Until EscapeKey()

peli:

Cls

x = ScreenWidth() - 20
y = ScreenHeight()/2

x2 = 20
y2 = ScreenHeight()/2

angle = 180
angle2 = 0

speed = 1
speed2 = 1

Repeat
    
    If LeftKey() Then angle = 180
    If RightKey() Then angle = 0
    If UpKey() Then angle = 270
    If DownKey() Then angle = 90
    
    If KeyDown(cbkeyA) Then angle2 = 180
    If KeyDown(cbkeyD) Then angle2 = 0
    If KeyDown(cbkeyW) Then angle2 = 270
    If KeyDown(cbkeyS) Then angle2 = 90
    
    x = x + Cos(angle) * speed
    y = y + Sin(angle) * speed
    
    x2 = x2 + Cos(angle2) * speed2
    y2 = y2 + Sin(angle2) * speed2
    
    If x < 1 Or x > ScreenWidth() - 2 Or y < 1 Or y > ScreenHeight() - 2 Then Color 0, 0, 255: Wait 500: Goto valikko
    If x2 < 1 Or x2 > ScreenWidth() - 2 Or y2 < 1 Or y2 > ScreenHeight() - 2 Then Color 255, 0, 0: Wait 500: Goto valikko
    
    If x = x2 And y = y2 Then win = 3: Wait 500: Goto valikko
    
    Color 255, 0, 0
    Dot x, y
    
    PickColor x + Cos(angle) * speed, y + Sin(angle) * speed
    
    If getRGB(RED) <> 0 Or getRGB(GREEN) <> 0 Or getRGB(BLUE) <> 0 Then 
        win = 2: Wait 500: Goto valikko
    EndIf
    
    Color 0, 0, 255
    Dot x2, y2
    
    PickColor x2 + Cos(angle2) * speed2, y2 + Sin(angle2) * speed2
    
    If getRGB(RED) <> 0 Or getRGB(GREEN) <> 0 Or getRGB(BLUE) <> 0 Then 
        win = 1: Wait 500: Goto valikko
    EndIf
    
    DrawScreen OFF
    
Until EscapeKey()
anttimoi
Newcomer
Posts: 25
Joined: Mon Aug 11, 2008 7:33 pm

Re: Pikku pelit

Post by anttimoi »

Tein kenon. :D
Muista lukea readme.
Attachments
Keno.rar
(590.72 KiB) Downloaded 249 times
Coolbasic roguelike-projekti menossa 8)
Progress bar @@@@@10%@@@@@
Pahasti jäätymässä...
DatsuniG
Advanced Member
Posts: 367
Joined: Fri Aug 15, 2008 9:57 pm

Re: Pikku pelit

Post by DatsuniG »

Tuhoa ruudun yläreunasta tippuvat kirjaimet painamalla vastaavaa näppäintä näppäimistössäsi! Peli käyttää omaa partikkelisysteemiään, jonka voi löytää "Esimerkkejä aloittelijoille" threadista. Muistakaa mys postailla pisteitänne. Oma ennätykseni on 2480.

Code: Select all

    SCREEN 800,600

    FrameLimit 50

    //////////////////////////
    //Pakolliset määrittelyt//
    //////////////////////////
    Type PAR                //
        Field X#            //
        Field Y#            //
        Field Img           //
        Field Angle         //
        Field Speed#        //
        Field Gravity#      //
        Field CurGravity#   //
        Field Ver#          //
    EndType                 //
    //////////////////////////

    //////////////////////
    img = MakeImage(3,3)//
    DrawToImage img     //// Luodaan partikkeleitä varten kuva
        Box 0,0,3,3     //
    DrawToScreen        //
    //////////////////////

    Type CHARZ
        Field x
        Field y#
        Field num
    EndType

    MaxAmount = 1
    CurAmount = 0
    Lifes = 15

    speed# = 1.0

    Repeat

    SetWindow "Pojot: " + Str(points) + " - Elämät: "+Lifes

    If Timer() - cTimer > 5000 And MaxAmount > CurAmount Then
        For i = 1 To MaxAmount - CurAmount
            add.CHARZ = New(CHARZ)
            add\x = Rand(2,ScreenWidth() - 18)
            add\y = Rand(-300,0)
            add\num = Rand(97,122)
            curAmount + 1
            If Rand(10) > 5 Then
                MaxAmount + 1
                speed + 0.05
            EndIf
            cTimer = Timer()
            points = Points + MaxAmount / 2
        Next i   
    EndIf

    key = GetKey()

    For add.CharZ = Each CharZ
        add\Y = add\y + Speed
        Text add\x,add\y,Chr(add\num)
        If key = add\num Then
            CurAmount - 1
            For i = 0 To 29 // Toistetaan 30 kertaa
                CreateParticle(img,add\x,add\y,Rand(359),0.8,0.05,-1.8) // Luodaan uusi partikkeli
            Next i
            Delete add
        EndIf
       
        If add\y > ScreenHeight() Then Lifes - 1 : Delete add : CurAmount - 1
    Next add

    If Lifes < 1 Then MakeError points

    UpdateParticles()

    DrawScreen

    Forever

    Function CreateParticle(img,x#,y#,angle,speed#,gravity#,ver#)
        uusi.PAR = New(Par)
        uusi\x = x
        uusi\y = y
        uusi\Img = CloneImage(Img)
        uusi\Angle = Angle
        uusi\Speed = Speed
        uusi\Gravity = Gravity
        uusi\CurGravity = ver * Rnd(0.1,0.9)

    EndFunction

    Function UpdateParticles()
        For uusi.PAR = Each PAR
            uusi\CurGravity = uusi\CurGravity + uusi\Gravity
            uusi\x = uusi\x + Cos(uusi\Angle) * uusi\Speed
            uusi\y = (uusi\y + uusi\CurGravity) - Sin(uusi\Angle) * uusi\Speed
            DrawImage uusi\Img, uusi\x, uusi\y
            If uusi\x< 0 Or uusi\x>ScreenWidth() Or uusi\y<0 Or uusi\y>ScreenHeight() Then Delete uusi
        Next uusi
    EndFunction
       
        
Last edited by DatsuniG on Tue Mar 17, 2009 5:21 pm, edited 1 time in total.
Hengität nyt manuaalisesti.
Awaclus
Forum Veteran
Posts: 2939
Joined: Tue Aug 28, 2007 2:50 pm

Re: Pikku pelit

Post by Awaclus »

DatsuniG wrote:Tuhoa ruudun yläreunasta tippuvat kirjaimet painamalla vastaavaa näppäintä näppäimistössäsi! Peli käyttää omaa partikkelisysteemiään, jonka voi löytää "Esimerkkejä aloittelijoille" threadista. Muistakaa mys postailla pisteitänne. Oma ennätykseni on 2480.

Code: Select all

KOODIA
Yli 7000 pistettä. Teen kohta botin, joka painaa kaikkia kirjaimia älyttömän nopeasti, katsotaan, paljon se saa pisteitä. EDIT: zxcvbnmqwertyuiopåasdfghjklöäzxcvbnmqwertyuiopåasdfghjklöäzxcvbnmqwertyuiopåasdfghjklöäzxcvbnmqwertyuiopåasdfghjklöäzxcvbnmqwertyuiopåasdfghjklöäzxcvbnmqwertyuiopåasdfghjklöäzä
- tuon botti kirjoitti alle sekunnissa, se sai 70496 pistettä ennen kuin elämät loppuivat.
Last edited by Awaclus on Mon Mar 16, 2009 10:06 pm, edited 1 time in total.
User avatar
TheDuck
Devoted Member
Posts: 632
Joined: Sun Aug 26, 2007 3:51 pm
Location: C:\Program Files\Tuusula\

Re: Pikku pelit

Post by TheDuck »

Ihan mukava tuo on. Tosin nuo partikkelit sais kiihtyä alaspäin mentäessä. 2842 pistettä sain. :P
^^
DatsuniG
Advanced Member
Posts: 367
Joined: Fri Aug 15, 2008 9:57 pm

Re: Pikku pelit

Post by DatsuniG »

TheDuck wrote:Ihan mukava tuo on. Tosin nuo partikkelit sais kiihtyä alaspäin mentäessä. 2842 pistettä sain. :P
Kyllähän ne kiihtyy, hitaasti vain D :
Hengität nyt manuaalisesti.
Awaclus
Forum Veteran
Posts: 2939
Joined: Tue Aug 28, 2007 2:50 pm

Re: Pikku pelit

Post by Awaclus »

DatsuniG wrote:
TheDuck wrote:Ihan mukava tuo on. Tosin nuo partikkelit sais kiihtyä alaspäin mentäessä. 2842 pistettä sain. :P
Kyllähän ne kiihtyy, hitaasti vain D :
Voisivat kiihtyä nopeammin, tällä koneella tuossa 70k+ pisteissä alkoi lagailemaan aika tehokkaasti ja botti ei enää kyennyt naputtelemaan kaikkia kirjaimia. Sen lisäksi niitä saisi tulla vähäsen vähemmän.
Mickey
Newcomer
Posts: 33
Joined: Sat Feb 09, 2008 10:32 am
Location: Liminka

Re: Pikku pelit

Post by Mickey »

Tein tällaisen piirtokomentoräiskinnän kahdella aseella:

Code: Select all

FrameLimit 60
SCREEN 400,400
SetWindow "Pikkuräiskintä",0,"Haluatko varmasti lopettaa?"
SAFEEXIT OFF

Dim weap (1) As String
weap (0) = "konekivääri"
weap (1) = "haulikko"

Type enemies
    Field x As Float
    Field y As Float
    Field a As Float
    Field hp
    Field r
    Field t
End Type

Type bullets
    Field x As Float
    Field y As Float
    Field a As Float
    Field l
End Type

Type blood
    Field obj
    Field age
End Type

veri = MakeImage (1,1)
DrawToImage veri
    Color cbred
    Dot 0,0
DrawToScreen
Valikko:
DrawToWorld OFF
Repeat
    Color cbgreen
    For i = 1 To 400 Step 3
        For j = 1 To 400 Step 3
            Dot i,j
        Next j
    Next i
    Color cbblack
    Box 50,50,155,50
    Color 0,255,0
    Box 50,50,155,50,0
    Text 70,60,"Pikkuräiskintä"
    Text 70,80, "Tehnyt Mickey"
    For i = 0 To 400 Step 20
        Color cbblack
        Box 370,i,15,15
        Color 0,255,0
        Box 370,i,15,15,0
    Next i
    If MouseY () < 201 Then
        For i = -10 To 400 Step 20
            Color cbblack
            Box i,180,15,15
            Color 0,255,0
            Box i,180,15,15,0
        Next i
        Box 370,180,15,15
        Color 0,255,0
        Box 50,180,155,15
        Color cbblack
        CenterText 52,186,"Aloita peli",1
        Box 50,200,155,15
        Color 0,255,0
        Box 50,200,155,15,0
        CenterText 52,206,"Lopeta",1
        If MouseHit (1) Then Exit
    EndIf
    If MouseY () > 200 Then
        For i = -10 To 400 Step 20
            Color cbblack
            Box i,200,15,15
            Color 0,255,0
            Box i,200,15,15,0
        Next i
        Color cbblack
        Box 50,180,155,15
        Color 0,255,0
        Box 50,180,155,15,0
        CenterText 52,186,"Aloita peli",1
        Color 0,255,0
        Box 370,200,15,15
        Color 0,255,0
        Box 50,200,155,15
        Color cbblack
        CenterText 52,206,"Lopeta",1
        If MouseHit (1) Then End
    EndIf
    DrawScreen
Forever
DrawToWorld ON
Const r = 5
hp = 100
ajas = Timer () - 3000
w = 0
x = 0
y = 0
k = 0
Repeat
    Color 0,255,0
    Text 0,0,"Elämä: "+hp
    Text 0,10,"Ase: "+weap (w)
    Text 0,20,"Tapot: "+k
    Color cbred
    reload - 1    
    If Timer () > ajas + 5000 Then
        ajas = Timer ()
        vihu.enemies = New (enemies)
        vihu\a = GetAngle (vihu\x,vihu\y,x,y)
        vihu\hp = 10
        vihu\r = 25
        vihu\t = Rand (1)
        s = Rand (1,4)
        Select s
            Case 1
                vihu\x = -200
                vihu\y = 0
            Case 2
                vihu\x = 200
                vihu\y = 0
            Case 3
                vihu\x = 0
                vihu\y = -200
            Case 4
                vihu\x = 0
                vihu\y = 200
         End Select
    EndIf    
    x = x + (RightKey () - LeftKey ())
    x = Min (x,200)
    x = Max (x,-200)
    y = y + (UpKey () - DownKey ())
    y = Min (y,200)
    y = Max (y,-200)
    
    If MouseHit (2) Then w = Not w
    
    Select w
        Case 0
            If reload < 0 And MouseDown (1) Then
                reload = 5
                pauk.bullets = New (bullets)
                pauk\x = x
                pauk\y = y
                pauk\a = GetAngle (x,y,MouseWX (),MouseWY ()) 
                pauk\l = 1
            EndIf
        Case 1
            If reload < 0 And MouseHit (1) Then
                reload = 55
                For i = -5 To 5
                    pauk.bullets = New (bullets)
                    pauk\x = x
                    pauk\y = y
                    pauk\a = (GetAngle (x,y,MouseWX (),MouseWY ()))+i
                    pauk\l = 1
                Next i
            EndIf
    End Select
    
    For vihu.enemies = Each enemies
        vihu\r - 1
        vihu\a = CurveAngle (GetAngle (vihu\x,vihu\y,x,y),vihu\a,10)
        vihu\x = vihu\x + Cos (vihu\a)*0.5
        vihu\y = vihu\y - Sin (vihu\a)*0.5
        Circle2 (vihu\x,vihu\y,r,1)
        If vihu\r < 0 Then
            Select vihu\t
                Case 0
                    vihu\r = 5
                    pauk.bullets = New (bullets)
                    pauk\x = vihu\x
                    pauk\y = vihu\y
                    pauk\a = GetAngle (vihu\x,vihu\y,x,y)  
                    pauk\l = 0
                Case 1
                    vihu\r = 55
                    For i = -5 To 5
                        pauk.bullets = New (bullets)
                        pauk\x = vihu\x
                        pauk\y = vihu\y
                        pauk\a = (GetAngle (vihu\x,vihu\y,x,y))+i  
                        pauk\l = 0
                    Next i
            End Select
        EndIf
        If vihu\hp < 0 Then
            k + 1
            emit.blood = New (blood)
            emit\obj = MakeEmitter (veri,10)
            ParticleEmission emit\obj,0,20,180
            ParticleMovement emit\obj,2,0
            PositionObject emit\obj,vihu\x,vihu\y
            Delete vihu
        EndIf
    Next vihu
    Color cbwhite
    Circle2 (x,y,r,1)
    
    
    For pauk.bullets = Each bullets
        pauk\x = pauk\x +Cos (pauk\a)*3
        pauk\y = pauk\y -Sin (pauk\a)*3
        Select pauk\l
            Case 1
                Color cbwhite
                Dot pauk\x,pauk\y
                For vihu.enemies = Each enemies
                    If Distance (pauk\x,pauk\y,vihu\x,vihu\y) < r + 1 Then
                        Delete pauk
                        vihu\hp-1
                    EndIf
                Next vihu
            Case 0
                Color cbred
                Dot pauk\x,pauk\y
                    If Distance (pauk\x,pauk\y,x,y) < r + 1 Then
                        Delete pauk
                        hp-1
                    EndIf
        End Select
    Next pauk
    
    For pauk.bullets = Each bullets
        If OutScreen (pauk\x,pauk\y) Then Delete pauk
    Next pauk
    
    For emit.blood = Each blood
        emit\age + 1
        If emit\age > 10 Then DeleteObject emit\obj : Delete emit
    Next emit
    DrawScreen
    If EscapeKey () Then Goto valikko
    If hp <1 Then Goto loppu
Forever
loppu:
    For vihu.enemies = Each enemies
        Delete vihu
    Next vihu
    For pauk.bullets = Each bullets
        Delete pauk
    Next pauk
    For emit.blood = Each blood
        Delete emit
    Next emit
        DrawToScreen
    Color cbgreen
    For i = -200 To 200 Step 3
        For j = -200 To 200 Step 3
            Dot i,j
        Next j
    Next i
    Color cbblack
    Box -120,25,240,50
    Color 0,255,0
    Box -120,25,240,50,0
    CenterText 200,185,"Sait "+k+" tappoa"
    CenterText 200,205,"Paina mitä tahansa näppäintä"
    DrawScreen
    WaitKey
    Goto valikko

Function Circle2(x#, y#, r#, fill=0)
    Circle x - r, y + r, r * 2, fill
EndFunction

Function OutScreen (x,y)
    If x < -(ScreenWidth ()/2) Or x > (ScreenWidth ()/2) Or y < -(ScreenHeight ()/2) Or y > (ScreenHeight ()/2) Then Return 1
    Return 0
End Function
Pikku vinkki: vaikka aseet ovat käytännössä yhtä tehokkaat, suosittelen käyttämään haulikkovihuja vastaan konekivääriä ja toisinpäin. Oma ennätykseni on yli 100 tappoa.
EDIT:

:oops: , unohdin kerto näppäimet. Ne ovat:
Nuolet: Liikkuminen
Hiiren vasen: ampuminen
Hiiren oikea: aseen vaihto

4-Dimensional Games:
Kotisivu (Täältä löydät tietoja sekä peliemme latauslinkit.)
Facebook-sivu (Täältä löydät esimerkiksi uutisia peliemme ja sivumme päivityksistä.)
Post Reply