AppTitle "MegaMan Revolution - RAVKENŽ Productions" Scr% = Input$("Press 1 for FULL SCREEN, 2 for WINDOW: > ") W = 800 H = 600 Bit = 16 Graphics W,H,Bit,Scr SeedRnd (MilliSecs()) ;Graphics 800,600,16,1 ;ClsColor 18,24,109 ;Cls ;Text 70,20,"Press F1 for Window Screen" ;Text 70,40,"Press F2 for Full Screen" ;Text 20,80, "Make sure that your Max Resolutionis 1024,768" ;Text 10,120, "To change your Resulution, go to:" ;Text 10,140, "Control Panel/ Display/ 'Tab' Settings ;Repeat ;If KeyHit(59) ;F1 ; graphic = 1 ;Window Screen ;EndIf ;If KeyHit(60) ;F2 ; graphic = 2 ;Full Screen ;EndIf ;Until KeyHit(59) Or KeyHit(60) ;If graphic = 1 ; Graphics 800,600,16,2 ;EndIf ;If graphic = 2 ; Cls ; Graphics 800,600,16,1 ;EndIf ;ClsColor 0,0,0 ;presentation Global fntArial30= LoadFont("Arial",30,True,True,False) Global fntArial20= LoadFont("Arial",20,True,False,False) Global fntArial70= LoadFont("Arial",70,True,False,True) start = LoadImage ("image/start.jpg") Cls DrawImage start,0,0 SetFont fntArial30 Text 100,100, "G "+ "e "+"n "+"e "+"r "+ "a "+ "l "+ " K "+ "e "+ "y "+"s" Text 200,200, "i = info (toggle on/off)" Text 200,250, "K = ST 1 (If man is 2)" Text 200,300, "Esc = Exit Game" Text 200,500, "Press any key to continue..." WaitKey Cls DrawImage start,0,0 SetFont fntArial30 Text 380,550, "Loading . . ." Delay (1000) ;END PRESENTATION ;THINK ABOUT IT< THIS AUTO HANDLE AutoMidHandle True ;Constants Global L = 203, R = 205, K = 37, P = 42, SP= 57, I = 23, LS= 42 Global F3 = 61, F4 = 62 ;GamePad Buttons Global B = 2, RB = 8 ;sound Global sf2 = LoadSound ("image/sf2.ogg") ;load images Global Kunglao = LoadAnimImage ("image/KunglaoSprite.png",99,150,0,20) Global BadGuyImg = LoadAnimImage ("image/badguy.bmp", 70, 60,0,24) Global alienImg = LoadAnimImage ("image/alien.bmp",68,32,0,10) Global explosionImg = LoadAnimImage ("image/explosion.bmp",64,64,0,8) Global healthImg = LoadAnimImage ("image/health.bmp",33,21,0,10) Global baloon = LoadImage ("image/baloon.bmp") Global girl = LoadImage ("image/girl.bmp") Global scrat = LoadImage("image/scrat.jpg") Global BlueSky = LoadImage ("image/Blue.bmp") Global RunImg = LoadAnimImage ("image/Run.bmp",60,60,0,20) Global OneUp = LoadImage ("image/1up.bmp") Global Win = LoadAnimImage ("image/megaWin.bmp", 40, 60,0,4) Global NES = LoadImage ("image/NES.bmp") Global FloorImg = LoadImage ("image/floor.bmp") Global backg = LoadImage ("image/backg.jpg") Global GameP = LoadImage ("image/gamepad.jpg") Global KeyB = LoadImage ("image/KeyB.jpg") ;Mask the image with white MaskImage RunImg, 255,255,255 MaskImage Win, 255,255,255 MaskImage OneUp, 255,255,255 MaskImage backg, 255,255,255 MaskImage girl, 255,255,255 MaskImage baloon, 255,255,255 MaskImage BadGuyImg, 255,255,255 MaskImage scrat, 255,255,255 MaskImage Kunglao, 0,255,0 ;CONSTANTS <<< Global round = 3 Global endWin = 1 Global speed = 5 ;<<<<<<<<<<<<<<<<<<<<<<< DELETE THIS 2 constants IF NECESSARY ************************ TYPES ;REMEMBER TO GET ALL CONSTANTS THAT ARE ALL AROUND IN HERE (BE ORGANIZE) ;BadGuy Type BadGuy Field x Field y Field image Field frame End Type Global BadGuy.BadGuy = New BadGuy BadGuy\frame = 0 BadGuy\image = BadGuyImg ;EXPLOSIONS Type explosion Field x Field y Field frame Field image End Type Global explosion.explosion = New explosion explosion\x = explosion\x explosion\y = explosion\y explosion\image = explosionImg explosion\frame = 0 ;BACKGROUND Type background Field x,y Field image End Type Global backgr.background = New background backgr\x = -1200 backgr\y = 0 backgr\image = backg Type man Field x,y Field image Field frame End Type ;MegaMan Global man.man = New man man\x = 400 man\y = 300 man\image = RunImg man\frame = 0 ;Kunlao Global kun.man = New man kun\image = Kunglao kun\x = 100 kun\y = 476 kun\frame = 0 ;MegaMan when win Global man1.man = New man man1\image = Win man1\x = man\x man1\y = man\y man1\frame = 0 ;One Live UP Type OneUP Field x,y Field image End Type Global LiveUp.OneUp = New OneUp LiveUp\x = 100 LiveUp\y = 500 LiveUp\image = OneUp ;ALIENS Type alien Field x Field y Field image Field frame End Type Global alien.alien = New alien alien\x = LiveUp\x alien\y = LiveUp\y alien\image = alienImg alien\frame = 0 ;Floor Global FloorIm.OneUp = New OneUp FloorIm\x = 400 FloorIm\y = 500 FloorIm\image = FloorImg ;variable ;and toggles Global up = 1 Global st = 1 Global toggleKey = 1 Global toggleOverlap = 1 ;<<< This one is not in use YET) PlaySound sf2 control = 0 a = 1 While control = 0 If a = 1 Cls DrawImage start,0,0 SetFont fntArial30 Text 100,500, "Play w/ Keyboard (F3), Play w/ GamePad (F4)" a = 2 EndIf SetFont fntArial20 If KeyHit(F3) Cls DrawImage KeyB,400,300 Text 100,500, "You choose to play with the KEYBOARD" Delay (1000) Text 100,550, "Press any key to PLAY..." WaitKey control = 1 EndIf If KeyHit(F4) Cls DrawImage GameP,400,300 Text 100,500, "You choose to play with a GAMEPAD" Delay (1000) Text 100,550, "Press any key to PLAY..." WaitJoy control = 2 EndIf ;SET TO BACK BUFFER ;---------------------- If control = 1 Or control = 2 Delay(2000) EndIf Wend Cls SetBuffer BackBuffer() Global KeyH = 1 ;***************************************************************************** ;===================================================GAME scrollx = 0 While Not KeyHit(1) Cls ;TileImage BlueSky;, scrollx +1 ,0 ;If scrollx >= ImageWidth(BlueSky) ;scrollx = 0 ;EndIf DrawImage scrat,alien\x + 100, alien\y ;ClsColor 150,150,150 DrawImage backgr\image, backgr\x, backgr\y DrawImage girl,backgr\x - 900, backgr\y + 480 If up = 1 Live() EndIf state(st) ;if togglekey is 1 then test key if not, no key is test If control = 1 If toggleKey = 1 Key() EndIf EndIf If control = 2 If toggleKey = 1 JOYSTICK() EndIf EndIf bound() overlap() counts() aliens() BadG() ;------------- If KeyHit(K) st = 1 EndIf ;this if statement is ment to be erease ;--------------------- ;----------- If down= 1 alien\y = alien\y + 2 EndIf ;--------------------------- Delay 50 Flip Wend ;************************************************************************ ;================================================END GAME ;================================================TOWARDS THE EXIT SetFont fntArial20 Locate 0,0 SetFont fntArial30 Text 300,80, "CREDITS" SetFont fntArial20 Text 50, 170, "RAVKENŽ Productions 2005" Text 100,200, "Game Design.................... ------" Text 100,220, "Character Design............... CAPCOM" Text 100,240, "Sound Design................... Internet" Text 100,260, "Game Programmer................ -------" Text 100,280, "Graphics Design................ ---------" Text 100,300, "Background Design.............. ----------" Text 50,320, "____________________________________________________________________" SetFont fntArial30 Text 300, 340, "THANKS TO:" SetFont fntArial20 Text 100,360, "-------- :oP" Text 100,380, "--------" Text 100,400, "--- Tony" Text 100,420, "--------" Text 100,440, "-------" Text 100,500, "--------s :oP" Text 200,560, "Click 'OK' To Exit" Delay(3000) End ;================================================EXIT ;test collision Function overlap() ;If ImagesOverlap (LiveUp\image, LiveUp\x, LiveUp\y, RunImg, man\x, man\y) ;up = 2 ;I put this one just in case that the LiveUP were still ;overlaping with man\imageL ;st = 2 ; End If If ImagesOverlap (RunImg, man\x, man\y, FloorIm\image, FloorIm\x, FloorIm\y) If man\y > FloorIm\y man\y = FloorIm\y EndIf EndIf If ImagesOverlap (OneUp, LiveUp\x, LiveUp\y, FloorIm\image, FloorIm\x, FloorIm\y) If LiveUp\y > FloorIm\y LiveUp\y = FloorIm\y EndIf EndIf If ImagesOverlap (girl,backgr\x - 900, backgr\y + 480, RunImg, man\x, man\y) If st = 1 DrawImage baloon, backgr\x - 700, backgr\y + 340 SetFont fntArial70 Text 20,150,"HELP, I NEED SPRITES!" DrawImage kun\image, kun\x, kun\y, kun\frame kun\frame = kun\frame + 1 If kun\frame > 15 kun\frame = 0 EndIf EndIf EndIf End Function ;++++++++++++++= FUNCTIONS =++++++++++++++ ;test key ;keyboard Function Key() jump() ;------- SPEED -------- If KeyDown(LS) speed = 25 EndIf If Not KeyDown(LS) speed = 9 EndIf ;********************** If KeyDown(L) ;man\x = man\x - speed ;if you use this line, man will actually walk, not a good thing, unless... ;man end to the wall or finish the stage man\frame = man\frame + 1 backgr\x = backgr\x + speed + 10 If man\frame > 9 man\frame = 0 End If look = 1 ; 1 means to LOOK LEFT EndIf If KeyDown(R) ;man\x = man\x + speed ;same here< not a good thing. not yet man\frame = man\frame + 1 backgr\x = backgr\x - speed -10 If man\frame < 9 man\frame = 10 EndIf If man\frame => 19 man\frame = 10 EndIf look = 2 ; 2 means to LOOK RIGHT End If ;*************** FIX THIS LATER ************* ;If Not KeyDown(L) Or KeyDown(R) And st = 1 And look = 1 ; man\frame = 0 ;End If ;If Not KeyDown(L) Or KeyDown(R) And st = 1 And look = 2 ; man\frame = 10 ;EndIf ;--------------------------------------- End Function ;===================================JOYSTICK=========== Function JOYSTICK() If JoyDown(RB) speed = 25 EndIf If Not JoyDown(RB) speed = 9 EndIf If JoyX#() = - 1 man\x = man\x - speed man\frame = man\frame + 1 backgr\x = backgr\x + speed + 2 If man\frame > 9 man\frame = 0 End If look = 1 ; 1 means to LOOK LEFT EndIf If JoyX#()= 1 man\x = man\x + speed man\frame = man\frame + 1 backgr\x = backgr\x - speed -10 If man\frame < 9 man\frame = 10 EndIf If man\frame => 19 man\frame = 10 EndIf look = 2 ; 2 means to LOOK RIGHT End If If JoyDown(B) ;B is JUMP man\y = man\y - 15 If look = 1 man\frame = 3 EndIf If look = 2 man\frame = 14 EndIf If man\y <= 5 backgr\y = backgr\y + 20 EndIf EndIf If Not JoyDown(B) man\y = man\y + 35 If man\y => 500 backgr\y = backgr\y - 20 EndIf EndIf End Function ;END OF JOYSTICK============================================= ;test State Function state(st) If st = 1 Run(st) EndIf If st = 2 Run(st) ;manWin(st) EndIf End Function ;000000000000000000000000000000000000000000000000000000000000 ;States of the character MegaMan (the Postitions) Function jump() If KeyDown(SP) ;P is Left Shift for now man\y = man\y - 15 man\frame = 2 If man\y <= 5 backgr\y = backgr\y + 20 EndIf EndIf If Not KeyDown(SP) man\y = man\y + 35 If man\y => 500 backgr\y = backgr\y - 20 EndIf EndIf ;If man\y > 301 ; man\y = 300 ;EndIf ; If man\y <= 0 ; backg\y = 400 ; EndIf ; If man\y >= 2 ; backg\y = 300 ; EndIf End Function Function Run(st) DrawImage RunImg, man\x, man\y, man\frame Return (1) End Function ;Function RightRun(st) ;blablabla ;End Function Function manWin(st) DrawImage man1\image, man\x, man\y, man1\frame toggleKey = 2 man1\frame = man1\frame + 1 If round = 3 If man1\frame = 4 man1\frame = 0 endWin = endWin + 1 EndIf EndIf If endWin = 4 round = 0 man1\frame = 0 ;after Run() , you have to get out of manWin(st) Function toggleKey= 1 Run(st) EndIf End Function Function bound() If backgr\x <= -1600 backgr\x = -1600 EndIf If backgr\x >= 2600 backgr\x = 2600 EndIf If backgr\y => 600 backgr\y = 600 EndIf If backgr\y <= 0 backgr\y = 0 EndIf If man\x <= 50 man\x = 50 EndIf If man\x >= 760 man\x = 760 EndIf If man\y <= 0 man\y = 0 EndIf ;ALIEN BOUNDURIES ;If alien\x =< -800 ; alien\x = alien\x + Rand(2,5) ; EndIf ; If alien\x => 1600 ; alien\x = alien\x - Rand(2,5) ; EndIf End Function Function counts() ;by default KeyH is 1 If KeyH = 2 SetFont fntArial20 Text 50,0,"ST =" + st,True,False Text 100, 0, "Background X = " + backgr\x Text 300, 0, "Man\X = " + man\x Text 425, 0, "Mega\Y = " + man\y Text 600, 0, "Time = " + MilliSecs() Text 280, 20, "THIS IS JUST A PROJECT GAME IN PROGRESS" EndIf If KeyHit(I) ;Number 1 on the keyboard KeyH = KeyH + 1 EndIf If KeyH => 3 KeyH = 1 EndIf End Function Function Live() LiveUp\x = backgr\x - 1050 LiveUp\y = backgr\y + 210 ;drawimage LiveUp, LiveUp\x, LiveUp\y End Function Function aliens() alien\x = backgr\x + 100 alien\y = backgr\y - 300 DrawImage alienImg, alien\x,alien\y, alien\frame ;alien\y = backgr\y + Rand(20,400) ;alien\y = alien\y + Rnd(2,5) ;not FOR NOW alien\frame = alien\frame + 1 ;frame loop If alien\frame > 9 alien\frame = 0 EndIf If ImagesOverlap (alienImg,alien\x,alien\y, RunImg,man\x,man\y) DrawImage explosionImg, alien\x, alien\y, explosion\frame explosion\frame= explosion\frame + 1 If explosion\frame > 7 explosion\frame = 0 EndIf If st = 2 SetFont fntArial30 Text alien\x - 200, alien\y + 200,"Watch out for the BAD GUY" EndIf st =2 EndIf End Function Function BadG() BadGuy\x = backgr\x - 720 BadGuy\y = backgr\y + 500 If st = 2 ;MilliSecs() => 1100000 DrawImage BadGuy\image, BadGuy\x, BadGuy\y, BadGuy\frame BadGuy\frame = BadGuy\frame + 1 If BadGuy\frame > 23 BadGuy\frame = 0 EndIf EndIf End Function ;REMEMBER TO PUT THEM BACK IF IS POSSIBLE ; If Not KeyDown(L) And st = 1 ; man\frame = 0 ;End If ;If ImagesOverlap (man\imageL, man\x, man\y, FloorIm\image, 400, 300) ; man\y = 300 ; EndIf