Tässä on kanssa yksi suhteellisen kauan sitten tekemä ohjelmani. Sen on tarkoitus havainnollistaa TYPEn käyttömukavuutta ja ylipäänsä ilotulitusta. Ehkä se toimisi paremmin jos tuota turhaa sälää ei olisi niin paljoa :D Älkää ampuko minua, tiedän tehneeni väärin kun yleensä ehdotin tätä ohjelmointiputkaan.
PS. Tuossa muuten näette useita sujuvia ja ihailtavia esimerkkejä siitä, kuinka englantia EI puhuta tai kirjoiteta.
' Ihmemies McEronen Software 13.12.2003 ` ' ÛÛÛÛÛÛ²ÛÛ±° ÛÛ± ±²ÛÛ °±±° ` ' ÛÛ²±° ÛÛ±° ÛÛ± ÛÛÛ ±Û±ÛÛÛ²ÛÛ±²ÛÛ °±±±±²²±° ` ' ÛÛÛÛÛÛ²ÛÛ±ÛÛ±ÛÛ±ÛÛ°ÛÛ±ÛÛÛ ±²ÛÛÛÛ °°±±±²²²ÛÛÛÛ²±° ` ' ÛÛ²±° ÛÛÛÛÛÛÛÛ±ÛÛ°ÛÛ±ÛÛ ±²ÛÛ²ÛÛ °±±±±²²±° ` ' ÛÛ²±° ÛÛ± ÛÛ± ÛÛÛ ±ÛÛ ±²ÛÛ±²ÛÛ °±±° ` ' Controller version 1.21 ` '*** AUTHOR *** '(C) Ihmemies McEronen Software / Topi Eronen 13.12.2003 'email: joe_eronen@suomi24.fi '*** ABOUT THE INDICATORS *** 'Green line: Player's health. When disappears, game is over 'Blue line: Atmosphere, how people feel. Try to keep as high as possible 'Red line: Resources used. When max, no more pixels appaears (in theory) 'Yellow line: JetPack fuel. When zero, you fall. Fall hurts. Not good. '*** KEY CODES *** 'Arrows = Move poor human around the table 'Up = Fly with JetPack 'Down = Stop sliding (moving) 'Enter = Drop basic firework 'NP 0 = Throw "popcorns" 'Space = Drop Cauldron Box (some multicannon) 'BckSpc = Drop "Millennium party" 'Delete = Clear all pixels from the sky 'End = Suicide (to see how blood flies) 'Esc = End this abject and useless little game 'That was all. There, couple of rows below, are some constant values, 'whose can be freely changed to customize show DECLARE SUB Demo () DECLARE SUB Explode (x#, y#, Horizontal#, Vertical#, BYVAL Size#, ColorFlag AS INTEGER) DECLARE SUB Hide (Index AS DOUBLE) DECLARE SUB Hurt (Damage AS INTEGER) DECLARE SUB Initialize () DECLARE SUB NewSpark (x#, y#, Hor#, Ver#, Clr#, SpawnFlag#, Specials#) DECLARE SUB Pause (DelayTime#) DECLARE SUB Range (Variable AS SINGLE) DECLARE SUB Sparks () DECLARE SUB SetLaunch (x AS INTEGER, Delay AS INTEGER, Specials AS INTEGER) : CONST Bullshit = 0, True = NOT Bullshit, False = 0, Never = 0 '*** CONSTANTS *** 'These values can be freely changed. Negative values are also False and 0 CONST FrameDelay = .03 'Time to wait between every frame (Seconds) CONST Sounds = True 'Tick when rocket flies and detonates CONST FadingSpeed = 3 'How fast sparkles disappears (0 = interesting) CONST Radius = 100 'Radius of detonation (Default 100%) CONST BloodAmount = 100 'How much blood when hurts (Default 100%) CONST CauldronBombs = 15 'How many little bombs Cauldron Box includes CONST ClusterBombs = 5 'How many little bombs Cluster launches CONST DrugMode = Never 'Alternative style, especially with Cauldron CONST PromptLoad = True 'Show LoadingMessage CONST LoadingMessage = " Wait..." 'Now, there shouldn't be anything interesting down there. 'So press [F5] to play. TYPE Launch x AS INTEGER Delay AS INTEGER Specials AS INTEGER END TYPE TYPE Object x AS SINGLE y AS SINGLE Hor AS SINGLE Ver AS SINGLE Clr AS INTEGER Visible AS INTEGER SpawnFlag AS INTEGER Specials AS INTEGER END TYPE CONST Blood = -3 CONST Heavy = -2 CONST Illusion = -1 CONST Normal = 0 CONST Tiny = 1 CONST Cluster = 2 CONST Pops = 3 CONST PopChild = 4 CONST Colors = 4 DIM SHARED SndCount AS INTEGER, SndDelay 'Sound counters DIM SHARED Human(1 TO 11) AS LONG, Dead AS INTEGER, Health AS SINGLE DIM SHARED Mx AS INTEGER, MH AS INTEGER, LastMX AS INTEGER, LastMH AS INTEGER DIM SHARED My AS SINGLE, lastMY AS INTEGER, MV AS SINGLE DIM SHARED Spark(0 TO 2729) AS Object 'Spark can also be a rocket DIM SHARED Launch(0 TO 50) AS Launch 'This launches a rocket DIM SHARED ShoutDelay AS INTEGER, ShoutX AS INTEGER DIM SHARED iCount AS LONG, Atmosphere AS SINGLE, Fuel AS SINGLE Initialize Demo SUB Demo DO COLOR 255: LOCATE 1: PRINT "FWork Ctl v1.2" PRINT "Health" + STR$(Health) + "% " IF Dead = Bullshit THEN Atmosphere = Atmosphere - .5 Range Health Range Atmosphere Range Fuel 'Draw indicators FOR y = 3 TO 6: LINE (1, y * 7 - 2)-(66, y * 7 - 2), 20: LINE (1, y * 7 - 2)-(66, y * 7), 40, B: NEXT LINE (Health / 100 * 63 + 2, 20)-(65, 20), 0: FOR i = 0 TO Health / 100 * 63: PSET (2 + i, 20), i + 126: NEXT i LINE (Atmosphere / 100 * 63 + 2, 27)-(65, 27), 0: FOR i = 0 TO Atmosphere / 100 * 63: PSET (2 + i, 27), i + 190: NEXT i LINE (iCount / UBOUND(Spark) * 63 + 2, 34)-(65, 34), 0: FOR i = 0 TO iCount / UBOUND(Spark) * 63: PSET (2 + i, 34), i: NEXT i LINE (Fuel / 100 * 63 + 2, 41)-(65, 41), 0: FOR i = 0 TO Fuel / 100 * 63: PSET (2 + i, 41), i + 64: NEXT i IF SndDelay > 0 THEN SndDelay = SndDelay - 1 IF SndDelay = 0 AND SndCount > 0 AND Sounds = True THEN SndCount = SndCount - 1: PLAY "MBL64<<<<cp64>>>>" IF ShoutDelay > 0 THEN ShoutDelay = ShoutDelay - 1 IF ShoutDelay = 40 AND ShoutX = 0 THEN ShoutX = Mx / 8 IF ShoutX < 1 THEN ShoutX = 1 IF ShoutX > 37 THEN ShoutX = 37 END IF IF ShoutX > 0 AND Dead = Bullshit THEN COLOR ShoutDelay * 1.5: LOCATE 23, ShoutX: PRINT "WOW!" IF ShoutDelay = 1 AND ShoutX > 0 THEN LOCATE 23, ShoutX: PRINT " ": ShoutX = 0 FOR i = 0 TO UBOUND(Launch) IF Launch(i).Delay > 0 THEN Spark = Bullshit SELECT CASE Launch(i).Specials CASE Tiny IF Launch(i).Delay / 9 = INT(Launch(i).Delay / 9) THEN Spark = True CASE Cluster NewSpark INT(Launch(i).x), 199, (RND - .5) / 5, -RND / 3, 63, 64, Illusion CASE Normal: Spark = True END SELECT IF Spark = True THEN NewSpark INT(Launch(i).x), 199, RND - .5, -RND * 1, 40, 64, Illusion 'Launch rocket IF Launch(i).Delay = 1 THEN FOR CountDown = 1 TO 3: Explode INT(Launch(i).x), 199, 0, 0, -.2, 1: NEXT NewSpark INT(Launch(i).x), 199, RND * 2 - 1, -RND - 8, 190, -RND * 30 - 30, INT(Launch(i).Specials) END IF 'Dud bombs 1:120 ' IF INT(RND * 120) = 0 THEN Launch(i).Delay = 1 Launch(i).Delay = Launch(i).Delay - 1 END IF NEXT IF Dead = True THEN LOCATE 13, 15: PRINT "Game over!": FOR CountDown = 1 TO 10 NewSpark RND * 30 + 112, 98, -RND + .5, -RND + .5, 63, 0, Illusion NewSpark RND * 37 + 152, 98, -RND + .5, -RND + .5, 63, 0, Illusion: NEXT END IF IF Health <= 0 AND Dead = Bullshit THEN FOR CountDown = 1 TO BloodAmount / 100 + 1: Explode INT(Mx + 2), My + CountDown, INT(MH), 0, BloodAmount / 500, 0: NEXT Dead = True: MH = 0: Health = 0 LINE (0, 192)-(319, 199), 0, BF END IF IF Dead = Bullshit THEN IF Mx <> LastMX OR My <> lastMY THEN LINE (LastMX, lastMY)-(LastMX + 4, lastMY + 7), 0, BF LastMX = Mx lastMY = My IF My + MV < 0 AND MV < 5 OR My + MV > 192 AND MV > 2.5 THEN Hurt ABS(MV) Mx = Mx + MH My = My + MV IF My <= 0 THEN My = 0: MV = 0 IF My >= 192 THEN My = 192: MV = 0 MV = MV + .5 IF Mx < 0 THEN Mx = 0: MH = 0 IF Mx > 314 THEN Mx = 314: MH = 0 PUT (Mx, My), Human, PSET END IF: IF MH <> 0 THEN LastMH = MH Sparks IF Dead = Bullshit AND My = 192 THEN ShotAbl = True ELSE ShotAbl = Bullshit SELECT CASE UCASE$(INKEY$) CASE CHR$(0) + "K": IF Dead = Bullshit THEN MH = MH - 1 CASE CHR$(0) + "M": IF Dead = Bullshit THEN MH = MH + 1 CASE CHR$(0) + "H" IF Dead = Bullshit THEN IF My = 192 OR Fuel > 0 THEN MV = MV - 3 IF Fuel > 0 THEN Fuel = Fuel - 2: FOR CountDown = 1 TO 5: NewSpark INT(Mx + 2), INT(My + 2), RND - .5, RND * 2, 30, 63, Illusion: NEXT END IF CASE CHR$(0) + "P": IF Dead = Bullshit AND My = 192 THEN FOR CountDown = 1 TO ABS(MH) * 3 - 3: NewSpark INT(Mx + 2), 199, RND * MH, -RND / 2, 30, 64, Illusion: NEXT: MH = 0 CASE CHR$(0) + "S" 'Clean skies ShoutDelay = 1 FOR i = LBOUND(Spark) TO UBOUND(Spark): PSET (Spark(i).x, Spark(i).y), 0: Hide INT(i): NEXT FOR i = LBOUND(Launch) TO UBOUND(Launch): Launch(i).Delay = 0: NEXT CASE CHR$(0) + "O": Health = 0 CASE CHR$(27): END CASE "0": IF ShotAbl = True THEN NewSpark INT(Mx + 2) + (SGN(LastMH) * 2), 192, SGN(LastMH) * 2, -1, RND * 50 + 70, 0, Pops CASE " ": IF ShotAbl = True THEN FOR CountDown = 1 TO CauldronBombs: SetLaunch Mx + 2, RND * (CauldronBombs * 9) + 20, Tiny: NEXT CASE CHR$(8): IF ShotAbl = True THEN SetLaunch Mx + 2, RND * 200 + 50, Cluster CASE CHR$(13): IF ShotAbl = True THEN SetLaunch Mx + 2, RND * 60 + 20, Normal CASE "Q": IF ShotAbl = True THEN FOR f = 1 TO 63: NewSpark INT(f), 20, 0, 0, 63 - f, 189, Illusion: NEXT END SELECT LOOP END SUB DEFDBL A-Z SUB Explode (x, y, Horizontal, Vertical, BYVAL Size, ColorFlag AS INTEGER) IF PromptLoad = True THEN LOCATE 23: PRINT LoadingMessage SndCount = ABS(Size) + 1 IF Size > 2.5 THEN ShoutDelay = 55 '"WOW!" -text IF Dead = Bullshit THEN Atmosphere = Atmosphere + (ABS(Size) * 5) 'Set bright background IF Size > 1 THEN Br = Size * 2 + 3 OUT &H3C8, 0: OUT &H3C9, Br: OUT &H3C9, Br: OUT &H3C9, Br MaxCounter = ABS(Size) * 150 Size = Size * (Radius / 100) FOR CountDown = 1 TO MaxCounter Ver = -ABS(Size) + (RND * ABS(Size) * 2) Hor = -ABS(Size) + (RND * ABS(Size) * 2) H = Hor / Ver * Hor Ver = Ver / Hor * Ver Hor = H Style = Normal IF Size < 0 THEN Style = Illusion IF ABS(Ver) < ABS(Size) * 1.3 AND ABS(Hor) < ABS(Size) * 1.3 THEN NewSpark x, y, Hor + Horizontal, Ver + Vertical, 50 + (RND * 13), ColorFlag * 63, Style IF PromptLoad = True THEN LINE (0, 188)-(CountDown / MaxCounter * 319, 189), CountDown / MaxCounter * 63, BF NEXT IF PromptLoad = True THEN COLOR 0: LOCATE 23: PRINT SPACE$(LEN(LoadingMessage)): LINE (0, 188)-(319, 189), , BF PALETTE 0, 0 END SUB DEFSNG A-Z SUB Hide (Index AS DOUBLE) IF Spark(Index).Visible = True THEN Spark(Index).Visible = Bullshit: iCount = iCount - 1 END SUB SUB Hurt (Damage AS INTEGER) Health = Health - Damage FOR CountDown = 1 TO Damage * (BloodAmount / 200): NewSpark Mx + 2, My + 8, RND - .5, -RND - 1, RND * 30 + 20, 0, Blood: NEXT END SUB SUB Initialize SCREEN 13 PALETTE 255, 63: COLOR 255: PRINT "Initializing colors, please wait..." FOR i = 0 TO 2: COLOR i * 62 + 63: PALETTE i * 62 + 63, 0: PRINT " Û Sample Û"; : NEXT 'Red FOR i = 0 TO 63: PALETTE i, i: NEXT 'Yellow FOR i = 0 TO 63: PALETTE i + 64, i * 257: NEXT 'Green FOR i = 0 TO 63: PALETTE i + 126, i * 256: NEXT 'Light blue FOR i = 0 TO 63: PALETTE i + 190, i * 256 * 257: NEXT x = 10: y = 100 LINE (x - 1, y + 1)-(x + 1, y + 4), 17, B CIRCLE (x, y), 1, 90 PSET (x, y), 99 LINE (x - 2, y + 2)-(x + 2, y + 2), 87 LINE (x - 1, y + 2)-(x + 1, y + 2), 40 LINE (x, y + 3)-(x, y + 4), 40 LINE (x - 1, y + 5)-(x - 1, y + 6), 40 LINE (x + 1, y + 5)-(x + 1, y + 6), 40 GET (x - 2, y - 1)-(x + 2, y + 6), Human LastMH = 1 Mx = 159 My = 192 Health = 100 Fuel = 100 RANDOMIZE TIMER COLOR 255: CLS IF BloodAmount > 500 THEN PRINT "Hmm, interesting..." PRINT : PRINT "Blood amount is set to " + LTRIM$(STR$(BloodAmount)) + "%." PRINT "That's quite lot, especially when" PRINT "player dies. But I have worn you..." LOCATE 22: PRINT "Press any key to continue..." DO: LOOP UNTIL INKEY$ <> "": CLS END IF END SUB DEFDBL A-Z SUB NewSpark (x, y, Hor, Ver, Clr, SpawnFlag, Specials) 'This makes impressive noise :) 'OPEN "~None.abc" FOR APPEND AS #1: CLOSE #1: KILL "~None.abc" FOR i = 0 TO UBOUND(Spark) IF Spark(i).Visible = Bullshit THEN Spark(i).x = x: Spark(i).y = y Spark(i).Hor = Hor: Spark(i).Ver = Ver Spark(i).Clr = Clr: Spark(i).SpawnFlag = SpawnFlag Spark(i).Specials = Specials Spark(i).Visible = True iCount = iCount + 1 EXIT SUB END IF NEXT END SUB SUB Pause (DelayTime) StartTime = TIMER DO: ThisTime = TIMER: LOOP UNTIL ThisTime - StartTime >= DelayTime OR ThisTime < StartTime END SUB DEFSNG A-Z SUB Range (Variable AS SINGLE) IF Variable < 0 THEN Variable = 0 IF Variable > 100 THEN Variable = 100 END SUB SUB SetLaunch (x AS INTEGER, Delay AS INTEGER, Specials AS INTEGER) FOR i = 0 TO UBOUND(Launch) IF Launch(i).Delay = 0 THEN Launch(i).x = x: Launch(i).Delay = Delay: Launch(i).Specials = Specials: EXIT FOR NEXT: MH = LastMH: MV = -2 END SUB SUB Sparks FOR i = 0 TO UBOUND(Spark) IF Spark(i).Visible = True THEN x = Spark(i).x: y = Spark(i).y PSET (x, y), 0 Spark(i).x = x + Spark(i).Hor IF Spark(i).Specials = Normal THEN Spark(i).x = Spark(i).x - (RND * 2) + 1 IF DrugMode = True AND Spark(i).SpawnFlag < 0 THEN Spark(i).Hor = Spark(i).Hor - (RND * 2) + 1 Spark(i).y = y + Spark(i).Ver Spark(i).Ver = Spark(i).Ver + ABS(Spark(i).Hor / 30) IF Spark(i).Specials = Heavy OR Spark(i).Specials = Blood THEN Spark(i).Ver = Spark(i).Ver + .1 x = Spark(i).x: y = Spark(i).y IF y > 200 AND Spark(i).Specials = Blood THEN Hide INT(i) IF Spark(i).Specials = Pops THEN IF y > 198 THEN Spark(i).Ver = -Spark(i).Ver / 1.5: Spark(i).y = 198 Spark(i).Ver = Spark(i).Ver + .3 SndCount = 1 Spark(i).Hor = (ABS(Spark(i).Hor) - .02) * SGN(Spark(i).Hor) FOR CountDown = 1 TO 3 NewSpark INT(x), INT(y), RND - .5 + Spark(i).Hor, RND - .5 + Spark(i).Ver, 60, 64, PopChild NEXT END IF 'Hit player IF x >= Mx - 1 AND x <= Mx + 5 AND y >= My - 1 AND y <= My + 8 AND Dead = Bullshit AND NOT Spark(i).Specials <= Illusion THEN IF Spark(i).SpawnFlag < 0 THEN Hurt INT(Health) ELSE Hide INT(i): Hurt 1 END IF IF Spark(i).Clr <= 0 THEN Hide INT(i): GOTO NextSpark PSET (x, y), ABS(Spark(i).Clr) + ABS(Spark(i).SpawnFlag) IF Spark(i).SpawnFlag >= 0 THEN Speed = FadingSpeed IF Spark(i).Specials = Normal OR Spark(i).Specials = Illusion THEN n = Speed IF Spark(i).Specials = PopChild THEN n = Speed * INT(RND * 6) IF Spark(i).Specials = Pops THEN n = 1 IF n >= Speed THEN n = Speed ELSE n = 1 IF Spark(i).Specials = Blood THEN n = 0 Spark(i).Clr = Spark(i).Clr - n ELSE Spark(i).Ver = Spark(i).Ver + .2 Spark(i).SpawnFlag = Spark(i).SpawnFlag + 1 f = 0 SELECT CASE Spark(i).Specials CASE Tiny: IF INT(RND * 2) = 0 THEN f = 1 CASE Cluster: f = 2 CASE ELSE: f = 1 END SELECT FOR CountDown = 1 TO f: NewSpark INT(x), INT(y), RND - .5 - Spark(i).Hor, -Spark(i).Ver / 2, 33, 64, Illusion: NEXT IF NOT Spark(i).Specials = Tiny AND Sounds = True THEN SOUND y + 750, .1 IF Spark(i).SpawnFlag = 0 OR Spark(i).y > 210 THEN DIM Size AS DOUBLE Hide INT(i) '*** EXPLOSION *** SELECT CASE Spark(i).Specials CASE Tiny: Count = 1: Size = RND / 5 + .4 CASE Cluster Size = 1.5: Count = 3 FOR CountDown = 1 TO ClusterBombs NewSpark INT(x), INT(y), RND * 4 - 2, -RND * 3 - 2, 60, -RND * 10 - 20, Tiny NEXT CASE ELSE: Count = 1: Size = RND * 3 + 1 END SELECT Clr = RND * Colors FOR CountDown = 1 TO Count Explode INT(x), INT(y), Spark(i).Hor / 3, Spark(i).Ver / 3, Size * CountDown, INT(Clr) NEXT END IF END IF END IF NextSpark: NEXT Pause FrameDelay END SUB
Tämähän on hieno!
Binaryyyy
Älä aina vaadi sitä binaryas. Vaan hanki qb. Ja tuo toimiikin vain QB 7.1:ssä
En saanu toimii, valitti jotai errorii:
SUB Explode (x, y, Horizontal, Vertical, BYVAL Size, ColorFlag AS INTEGER)
...tossa BYVAL kohdassa.
Yritin kans vääntää qb:llä ilotulitusta mut ei siitä mitään tullu. Toiseks mää en olis ikä maailmassa pystyny kuvittelemaan et siitä oli tullu noi hiano. Tosi mahtava!
Siis: en OLISI pystynyt ikä maailmassa kuvittelemaa...
T.M. Kuten jo sanoin TOIMII VAIN QuickBasic 7.1:SSÄ!!!!!!!!
ei toiminu siinäkää...:@
ET VAIN OSAA! :D :P
Ei muuten meidän koulun koneissa riittäny DOSmuisti lataamaan tota ohjelmaa :D
Ei muuten munkaan koulussa :D kas miksköhän, ei ainakaan varmaan siksi että ollaan samassa koulussa :D
nt-pohjasien wintoosien dossi on niin fake että niissä on tosivähän muistia, ja qb:tä käytettäessä pirun vähän. onneksi ohjelmista voi tehdä monta motuulia ja ajaa sen sitten sillä tavalla :P
Erinomainen esimerkki TYPE sekä myös paletin käytöstä. Oletin pitkästä koodista päätellen jotain vähän erikoisempaa, mutta kyllä tämä ihan hieno on. Arvelen vain, että sen olisi voinut toteuttaa lyhyemmälläkin koodilla.
lainaus:
no more pixels appaears
Tuon tulisi olla "appear", monikossa ei tule ässää. No niin pilkunviilausta taas kerran, kyllähän sinä jo ilmoititkin, että kirjoitusvirheitä on. Mitäpä minä niitä havainnollistamaan.
Jaahas lainaus toimii näemmä kuitenkin vaikkei Lainaa-linkkiä olekaan.
Niin ja vielä tuosta koodista. Systeemi on hyvin samantapainen kuin monissa mitä olen itsekin tehnyt joihinkin Wormsin tapaisissa 2d-räiskintöihin, missä lentää kipinöitä, kun pommit osuvat maahan, jos otetaan huomioon pisteiden liikuttaminen ja muu, ainakin jos koodista oikein päättelin. Nuo monipuoliset pommit tuovat lisäväriä demoon.
Tehkää joku tästä exe
Vasta nyt pääsin katsomaan HIEANO!!!, ja ei voi tehdä exeä koska exetettäessä Initializen kohdalla sanoo "data memory owerflow"
lainaus:
En saanu toimii, valitti jotai errorii:
SUB Explode (x, y, Horizontal, Vertical, BYVAL Size, ColorFlag AS INTEGER)...tossa BYVAL kohdassa.
sama juttu
aha...
latasin sen 7.1
toimiiiiiiiiiiiiiiiiiiiiiii....
vähän hyvä
Hmm, tästä vois tosiaan tehdä binaryn... Mutta itelläni ei riitä muisti kääntämiseen, että jos joku on viritellyt yltiömuistavat Dosasetukset itselleen niin voisi kääntää jos tykkäisi?
Aihe on jo aika vanha, joten et voi enää vastata siihen.