Advertisement
Guest User

DKC2 Engine PB FullSource 2017

a guest
May 9th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.96 KB | None | 0 0
  1. ; PROJECT : Castle Crush
  2. ; AUTHOR : NA
  3. ; CREATED : 12/27/2011
  4. ; EDITED : 4/16/2015
  5. ; ---------------------------------------------------------------------
  6. SETFPS 60
  7. openscreen 1024, 768, 32, 1
  8. ;castle=loadnewfximage("castlecrush.png")
  9. ;castle=newfximage(12000, 500*16)
  10. ;rendertoimage castle
  11. cls rgb(0, 0, 0)
  12.  
  13. print "Press any key to start"
  14. sync
  15. waitkey
  16. waitnokey
  17.  
  18. ;imagemaskcolour castle, rgb(255, 0, 255) ;purpleish?
  19. ;imagemaskcolour castle, rgb(255, 255, 255) ;white
  20. mode=loadnewfximage("mode.png")
  21. snd = loadnewsound("sounds/Barrel blast barrel.mp3")
  22. loading = loadnewsound("music/nintendo-21-steel-drum-rhumba.mp3");
  23. loaded = loadnewsound("music/nintendo-08-bayou-boogie.mp3");
  24. blastbarrel = loadnewsound("sounds/Barrel blast barrel.mp3");
  25. Crateopens = loadnewsound("sounds/Animal crate open DKC2.mp3");
  26. ballooncollect=loadnewsound("sounds/Life gained DKC2.mp3")
  27. bananacollect=loadnewsound("sounds/Banana DKC2.mp3")//the sound for a single banananay!!
  28. quay=loadnewfximage("maps/Krem_Quay_Overworld_-_Donkey_Kong_Country_2.png")
  29. scaleimage quay, 2, 2, 0
  30. overworldmusic=loadnewsound("music/nintendo-02-welcome-to-crocodile-isle.mp3")
  31.  
  32.  
  33. playsound snd;
  34. //playsound loading
  35. WIDTH=12000
  36. HEIGHT=500*16
  37. save=loadnewfximage("save.png")
  38. playmode=loadnewfximage("Playmode.png")
  39. grid=false
  40. backdrop=loadnewfximage("bgs/mine.png")
  41. imagemaskcolour backdrop, rgb(255, 255, 255)
  42. sky=loadnewfximage("Sprites/Bramble_sky.bmp")
  43. levelname$="castle crush"
  44. wallx=0
  45. wally=0
  46. bananatimer=timer()+30
  47. spinframe=1
  48. spinframetimer=timer()+30
  49. maxhelicopterfall=4
  50. barreli=loadnewfximage("Sprites/barrel.bmp")
  51. imagemaskcolour barreli, rgb(255, 255, 255)
  52. dixieholdingbarrel=false
  53. dixiemounted=false
  54. barrelwidth=30
  55. barrelheight=39
  56. pickingup=false
  57. puttingdown=false
  58. barrelfalltimer=timer()+30
  59. fallspeed=1
  60. menu=1 ;menu means current view of objects/tiles/sprites
  61. dixiemovespeed=6
  62. rambix=1000
  63. rambiy=320
  64. rambiframe=1
  65. beetimer=timer()+30
  66.  
  67.  
  68. //This deals with the squitter Crate, and squitter
  69. SquitterCrateX=0
  70. SquitterCrateY=0
  71. SquitterCrateFrame=1
  72. SquitterX=0
  73. SquitterY=0
  74. SquitterFrame=1
  75. CrateOpened=false; ///Don't animate the crate till it's open!
  76.  
  77.  
  78. ;inbarrel=false
  79. ;tileset$=currentdir$()+"rickety"
  80. ;if folderexist(tileset$);
  81. ; for temp=1 to
  82.  
  83.  
  84. ;if fileexist("C:\brambles_map2.txt")
  85. ;copyfile "C:\brambles_map2.txt", "levels\brambles_map2.txt"
  86. ;endif
  87.  
  88.  
  89.  
  90. tiles=loadnewfximage("Sprites/Bayou.png")
  91. dim tiles(598)
  92.  
  93. tile=1
  94. rendertoimage tiles
  95. for tempx=1 to 23
  96. for tempy=1 to 26
  97. x1=(tempx-1)*32
  98. y1=(tempy-1)*32
  99. x2=tempx*32
  100. y2=tempy*32
  101. ;x1=x1+tempx ;account for white space
  102. ;y1=y1+tempy ;account for white space
  103. ;x2=x2+tempx ;account for white space
  104. ;y2=y2+tempy ;account for white space
  105. tiles(tile)=newfximage(32, 32)
  106.  
  107. getimage tiles(tile), x1, y1, x2, y2
  108. imagemaskcolour tiles(tile), rgb(255, 255, 255)
  109. tile=tile+1
  110. ;if tile>598 then tile=598
  111. ;sync
  112. next tempy
  113. next tempx
  114.  
  115. rendertoscreen
  116. deleteimage tiles
  117.  
  118.  
  119.  
  120. dim dixieright(18)
  121. dim dixieleft(18)
  122. for temp=1 to 18
  123. dixieright(temp)=loadnewfximage("sprites/dixieframe"+str$(temp)+".bmp")
  124. imagemaskcolour dixieright(temp), rgb(255,255, 255)
  125. dixieleft(temp)=newfximage(55, 45)
  126. copyimage dixieright(temp), dixieleft(temp)
  127. mirrorimage dixieleft(temp), 1, 0
  128. next temp
  129.  
  130.  
  131. dim dixiejumpright(4)
  132. dim dixiejumpleft(4)
  133.  
  134. for temp=1 to 4
  135. dixiejumpright(temp)=loadnewfximage("Sprites/dixiejump"+str$(temp)+".bmp")
  136. imagemaskcolour dixiejumpright(temp), rgb(255, 255, 255)
  137. dixiejumpleft(temp)=newfximage(55, 74)
  138. copyimage dixiejumpright(temp), dixiejumpleft(temp)
  139. mirrorimage dixiejumpleft(temp), 1, 0
  140. imagemaskcolour dixiejumpleft(temp), rgb(255, 255, 255)
  141. next temp
  142.  
  143. dim squitterwalkright(15)
  144. for temp=1 to 15
  145. squitterwalkright(temp)=loadnewfximage("sprites/SquitterRight"+str$(temp)+".png")
  146. imagemaskcolour squitterwalkright(temp), rgb(255, 255, 255)
  147. next temp
  148.  
  149. dim dixieow(8)
  150. for temp=1 to 8
  151. dixieow(temp)=loadnewfximage("sprites/dixieow"+str$(temp)+".png")
  152. scaleimage dixieow(temp), 2, 2, 0
  153. imagemaskcolour dixieow(temp), rgb(255, 255, 255)
  154. next temp
  155.  
  156.  
  157.  
  158.  
  159. ;load and flip dixie's spinning animations for hovering helicoptering
  160.  
  161.  
  162. dim dixiespinright(10)
  163. dim dixiespinleft(10)
  164. for temp=1 to 10
  165. dixiespinright(temp)=loadnewfximage("Sprites/dixiespin"+str$(temp)+".bmp")
  166. dixiespinleft(temp)=newfximage(getimagewidth(dixiespinright(temp)), getimageheight(dixiespinright(temp)) )
  167. copyimage dixiespinright(temp), dixiespinleft(temp)
  168. mirrorimage dixiespinleft(temp), 1, 0
  169. imagemaskcolour dixiespinright(temp), rgb(255, 255, 255)
  170. imagemaskcolour dixiespinleft(temp), rgb(255, 255, 255)
  171. next temp
  172.  
  173.  
  174. dim dixiepickupbarrelright(14)
  175. dim dixiepickupbarrelleft(14)
  176.  
  177. for temp=1 to 14
  178. dixiepickupbarrelright(temp)=loadnewfximage("Sprites/dixiepickupbarrel"+str$(temp)+".bmp")
  179. dixiepickupbarrelleft(temp)=newfximage(getimagewidth(dixiepickupbarrelright(temp)), getimageheight(dixiepickupbarrelright(temp)) )
  180. copyimage dixiepickupbarrelright(temp), dixiepickupbarrelleft(temp)
  181. mirrorimage dixiepickupbarrelleft(temp), 1, 0
  182. imagemaskcolour dixiepickupbarrelleft(temp), rgb(255, 255, 255)
  183. imagemaskcolour dixiepickupbarrelright(temp), rgb(255, 255, 255)
  184. next temp
  185.  
  186.  
  187. dixiemountedright=loadnewfximage("Sprites/DixieRidingRight.bmp")
  188. dixiemountedleft=newfximage(getimagewidth(dixiemountedright), getimageheight(dixiemountedright) )
  189. copyimage dixiemountedright, dixiemountedleft
  190. mirrorimage dixiemountedleft, 1, 0
  191. imagemaskcolour dixiemountedleft, rgb(255, 255, 255)
  192. imagemaskcolour dixiemountedright, rgb(255, 255, 255)
  193.  
  194.  
  195.  
  196. dim barrel_(4)
  197. barrel_(1)=loadnewfximage("Sprites/Barrelup.bmp")
  198. barrel_(2)=loadnewfximage("Sprites/Barreldown.bmp")
  199. barrel_(3)=loadnewfximage("Sprites/Barrelleft.bmp")
  200. barrel_(4)=loadnewfximage("Sprites/Barrelright.bmp")
  201. for temp=1 to 4
  202. imagemaskcolour barrel_(temp), rgb(255, 255, 255)
  203. next temp
  204.  
  205. dim dk_barrel_(7)
  206. for temp=1 to 7
  207. dk_barrel_(temp)=loadnewfximage("Sprites/dkbarrel"+str$(temp)+".bmp")
  208. imagemaskcolour dk_barrel_(temp), rgb(255, 255, 255)
  209. next temp
  210.  
  211.  
  212. //This is the create squitter comes out of.
  213. //For now it will replace the test barrel in the code
  214. dim squittercrate(3)
  215. squittercrate(1)=loadnewfximage("Sprites/SpiderCrate.png")
  216. imagemaskcolour squittercrate(1), rgb(255, 255, 255)
  217. for temp=2 to 3
  218. squittercrate(temp)=loadnewfximage("Sprites/CrateOpen"+str$(temp-1)+".png")
  219. imagemaskcolour squittercrate(temp), rgb(255, 255, 255);
  220. next temp
  221.  
  222.  
  223. ;load zingers graphics
  224.  
  225. dim zingerfacesleft(3)
  226. dim zingerfacesright(3)
  227. for temp=1 to 3
  228. zingerfacesleft(temp)=loadnewfximage("Sprites/zingerframe"+str$(temp)+".bmp")
  229. zingerfacesright(temp)=newfximage(getimagewidth(zingerfacesleft(temp)), getimageheight(zingerfacesleft(temp)) )
  230. copyimage zingerfacesleft(temp), zingerfacesright(temp)
  231. mirrorimage zingerfacesright(temp), 1, 0
  232. imagemaskcolour zingerfacesleft(temp), rgb(255, 255, 255)
  233. imagemaskcolour zingerfacesright(temp), rgb(255, 255, 255)
  234. next temp
  235.  
  236. dim beatlefacesleft(8)
  237. dim beatlefacesright(8)
  238.  
  239. for temp=1 to 8
  240. beatlefacesleft(temp)=loadnewfximage("Sprites/Bugframe"+str$(temp)+".bmp")
  241. beatlefacesright(temp)=newfximage(getimagewidth(beatlefacesleft(temp)), getimageheight(beatlefacesleft(temp)) )
  242. copyimage beatlefacesleft(temp), beatlefacesright(temp)
  243. mirrorimage beatlefacesright(temp), 1, 0
  244. imagemaskcolour beatlefacesleft(temp), rgb(255, 255, 255)
  245. imagemaskcolour beatlefacesright(temp), rgb(255, 255, 255)
  246. next temp
  247.  
  248.  
  249. dim bananaframes(8)
  250. for temp=1 to 8
  251. bananaframes(temp)=loadnewfximage("Sprites/bananaframe"+str$(temp)+".png")
  252. imagemaskcolour bananaframes(temp), rgb(255, 255, 255)
  253. next temp
  254.  
  255.  
  256. dim rambi_run_right(15)
  257. dim rambi_run_left(15)
  258. for temp=1 to 15
  259. rambi_run_right(temp)=loadnewfximage("Sprites/Rambi_run"+str$(temp)+".bmp")
  260. rambi_run_left(temp)=newfximage(getimagewidth(rambi_run_right(temp)), getimageheight(rambi_run_right(temp) ) )
  261. copyimage rambi_run_right(temp), rambi_run_left(temp)
  262. mirrorimage rambi_run_left(temp), 1, 0
  263. imagemaskcolour rambi_run_right(temp), rgb(255, 255, 255)
  264. imagemaskcolour rambi_run_left(temp), rgb(255, 255, 255)
  265. next temp
  266.  
  267.  
  268. dim krook_walk_left(11)
  269. dim krook_walk_right(11)
  270. for temp=1 to 11
  271. krook_walk_left(temp)=loadnewfximage("sprites/krookwalkleft"+str$(temp)+".bmp")
  272. krook_walk_right(temp)=newfximage(getimagewidth(krook_walk_left(temp)), getimageheight(krook_walk_left(temp) ) )
  273. copyimage krook_walk_left(temp), krook_walk_right(temp)
  274. mirrorimage krook_walk_right(temp), 1, 0
  275. imagemaskcolour krook_walk_right(temp), rgb(255, 255, 255)
  276. imagemaskcolour krook_walk_left(temp), rgb(255, 255, 255)
  277. next temp
  278.  
  279. dim rolling_barrel(7)
  280. for temp=1 to 7
  281. rolling_barrel(temp)=loadnewfximage("sprites/rolling_barrel"+str$(temp)+".bmp")
  282. imagemaskcolour rolling_barrel(temp), rgb(255, 255, 255)
  283. next temp
  284.  
  285.  
  286.  
  287. dim balloon(5)
  288. for temp=1 to 5
  289. balloon(temp)=loadnewfximage("Sprites/RedBallon"+str$(temp)+".png")
  290. imagemaskcolour balloon(temp), rgb(255, 255, 255)
  291. next temp
  292.  
  293.  
  294.  
  295.  
  296. type camera
  297. x
  298. y
  299. endtype
  300.  
  301.  
  302. //We're going to make all of the above objects universal now
  303.  
  304.  
  305.  
  306. type object
  307. x //For bananas
  308. y //For bananas
  309. frame
  310. collected
  311. x1
  312. y1
  313. x2
  314. y2
  315. frametimer
  316. directionleft
  317. facing
  318. landed ;is able to fall off or walk off edges
  319. falling ;is able to fall
  320. obj_type //This lets us identify what the object is
  321. //We're going to say 1 is bananas
  322. //We're going to say 2 is beatles
  323. //We're going to say 3 is krooks
  324. //We're going to say 4 is zinger
  325.  
  326.  
  327.  
  328. endtype
  329.  
  330.  
  331. dim GameObjects(300) as object
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. //We don't need this anymore
  339. //dim bananas(50) as object
  340. current_object=1
  341. //These are bananas
  342. for temp=1 to 50
  343. //randomize timer()
  344. GameObjects(current_object).x=rndrange(0, WIDTH/5)
  345. GameObjects(current_object).y=rndrange(0, HEIGHT/5)
  346. GameObjects(current_object).frame=rndrange(1, 8)
  347. GameObjects(current_object).collected=false
  348. GameObjects(current_object).obj_type = 1
  349. current_object=current_object+1 //Iterate the current object pointer that way we know what we have
  350. next temp
  351.  
  352.  
  353.  
  354.  
  355. dim cameras(3) as camera
  356.  
  357. currentcamera=1
  358.  
  359.  
  360.  
  361. //dim krooks(32) as object
  362.  
  363. ///These are krooks
  364. for temp=1 to 32
  365. GameObjects(current_object).frame=1
  366. GameObjects(current_object).frametimer=timer()+30
  367. GameObjects(current_object).x1=rndrange(0, 500)
  368. GameObjects(current_object).y1=rndrange(0, 400)
  369. GameObjects(current_object).facing=rndrange(1, 2)
  370. GameObjects(current_object).directionleft=300
  371. GameObjects(current_object).obj_type = 2
  372. current_object=current_object+1
  373.  
  374. next temp
  375.  
  376.  
  377.  
  378. //dim zingers(32) as object These are zingers
  379.  
  380.  
  381. for temp=1 to 32
  382. GameObjects(current_object).frame=1
  383. GameObjects(current_object).frametimer=timer()+30
  384. GameObjects(current_object).x1=rndrange(0, 500)
  385. GameObjects(current_object).y1=rndrange(0, 400)
  386. GameObjects(current_object).facing=rndrange(1, 2)
  387. //if GameObjects(current_object).facing=0 then GameObjects(current_object).facing=1
  388.  
  389. GameObjects(current_object).directionleft=30
  390. GameObjects(current_object).obj_type = 3
  391. current_object=current_object+1
  392. next temp
  393.  
  394. //dim beatles(50) as object
  395.  
  396.  
  397. for temp=1 to 32
  398. GameObjects(current_object).frame=1
  399. GameObjects(current_object).frametimer=timer()+30
  400. GameObjects(current_object).facing=rndrange(1, 2)
  401. GameObjects(current_object).falling=true
  402. GameObjects(current_object).landed=false
  403. GameObjects(current_object).x1=rndrange(0, 500)
  404. GameObjects(current_object).y1=rndrange(0, 400)
  405. GameObjects(current_object).obj_type = 4
  406. current_object=current_object+1
  407. next temp
  408.  
  409.  
  410. //Note to self, add an attribute called collected_Sound later
  411.  
  412.  
  413. for temp=1 to 32
  414. gameobjects(current_object).frame=1
  415. gameobjects(current_object).frametimer=timer()+10
  416. gameobjects(current_object).falling=false
  417. gameobjects(current_object).landed=false
  418. gameobjects(current_object).x=rndrange(0, WIDTH/5)
  419. gameobjects(current_object).y=rndrange(0, HEIGHT/5)
  420. gameobjects(current_object).obj_type=5
  421. gameobjects(current_object).collected=false
  422. current_object=current_object+1
  423. next temp
  424.  
  425.  
  426.  
  427.  
  428. dim dkcoin(8)
  429. for temp=1 to 8
  430. dkcoin(temp)=loadnewfximage("Sprites/dkcoinframe"+str$(temp)+".bmp")
  431. imagemaskcolour dkcoin(temp), rgb(255, 255, 255)
  432. next temp
  433.  
  434. dkcoinframe=1
  435.  
  436.  
  437.  
  438. obj_hook=loadnewfximage("Sprites/Obj_hook.bmp")
  439. imagemaskcolour obj_hook, rgb(255, 255, 255)
  440.  
  441.  
  442. dixieaction=1
  443. jumpframe=1
  444. dixieblasted=false
  445. ;for editing stuff right here <
  446.  
  447. current_blast_barrel=1
  448.  
  449. ;>
  450.  
  451.  
  452.  
  453.  
  454. SCROLLX=0
  455. SCROLLY=0
  456. MAPWIDTH=roundup(WIDTH/16)
  457. MAPHEIGHT=roundup(HEIGHT/16)
  458.  
  459. spritewidth=35
  460. spriteheight=25
  461. dixieframe=1
  462. frametimer=timer()+30
  463. maxfallspeed=12
  464. falltimer=timer()+30 ;.5 miliseconds for falling increase
  465. wallspeed=25
  466. charx=400
  467. chary=12128
  468. falling=false
  469. walltimer=timer()+wallspeed
  470. spunalready=false
  471. spinning=false
  472. MODE$="View"
  473.  
  474. type solid_tile
  475. x1
  476. y1
  477. x2
  478. y2
  479. endtype
  480.  
  481. type barrel
  482. x1
  483. y1
  484. x2
  485. y2
  486. falling
  487. landed
  488. fallspeed
  489. draw
  490. falltimer
  491. state
  492. frame
  493. frametimer
  494. endtype
  495.  
  496. type blast_barrel
  497. x1
  498. y1
  499. x2
  500. y2
  501. facing_type
  502. blast_range
  503. endtype
  504.  
  505. type hookobj
  506. x1
  507. y1
  508. x2
  509. y2
  510. endtype
  511.  
  512.  
  513. dim b_barrels(30) as blast_barrel
  514. for temp=1 to 30
  515. b_barrels(temp).facing_type=1
  516. next temp
  517.  
  518.  
  519.  
  520. dim barrels(100) as barrel
  521. for temp=1 to 100
  522. barrels(temp).fallspeed=1
  523. barrels(temp).falling=true
  524. barrels(temp).landed=false
  525. barrels(temp).x1=rndrange(0, 640)
  526. barrels(temp).y1=rndrange(0, 640)
  527. barrels(temp).draw=true
  528. barrels(temp).falltimer=timer()+100
  529. barrels(temp).state=1
  530. barrels(temp).frame=1
  531. barrels(temp).frametimer=timer()+30
  532. next temp
  533.  
  534. dim hooks(30) as hookobj
  535.  
  536. current_hook=1
  537.  
  538.  
  539.  
  540. dim map(MAPWIDTH, MAPHEIGHT)
  541. dim TILEMAP(MAPWIDTH/2, MAPHEIGHT/2) ;32 by 32 pixel tiles
  542. dim solids(MAPWIDTH, MAPHEIGHT) as solid_tile
  543. read=true
  544. if fileexist("levels\brambles_map3.txt") then read=true
  545.  
  546. IF READ=TRUE
  547. readfile "levels\brambles_map3.txt", 1
  548. ink rgb(0, 0, 255)
  549. tile_to_read=1
  550. totaltiles=MAPWIDTH*MAPHEIGHT
  551. rendertoscreen
  552. Mapwidth=readint(1)
  553. mapheight=readint(1)
  554. charx=readint(1)
  555. chary=readint(1)
  556. scrollx=readint(1)
  557. scrolly=readint(1)
  558. dim map(MAPWIDTH, MAPHEIGHT)
  559. dim TILEMAP(MAPWIDTH/2, MAPHEIGHT/2) ;32 by 32 pixel tiles
  560. dim solids(MAPWIDTH, MAPHEIGHT) as solid_tile
  561.  
  562. coinframetimer=timer()+30
  563.  
  564.  
  565.  
  566.  
  567.  
  568. for tempx=1 to MAPWIDTH
  569. for tempy=1 to MAPHEIGHT
  570. map(tempx, tempy)=readint(1)
  571. solids(tempx, tempy).x1=readint(1)
  572. solids(tempx, tempy).y1=readint(1)
  573. solids(tempx, tempy).x2=readint(1)
  574. solids(tempx, tempy).y2=readint(1)
  575. x1=solids(tempx, tempy).x1
  576. y1=solids(tempx, tempy).y1
  577. x2=solids(tempx, tempy).x2
  578. y2=solids(tempx, tempy).y2
  579. ;rendertoimage castle
  580. ;box x1, y1, x2, y2,
  581. ;rendertoscreen
  582.  
  583.  
  584. ;tile_to_read=tile_to_read+1
  585. next tempy
  586. print "Loading SOLID TILE DATA PLEASE WAIT "
  587. print "Reading Across X: "+str$(tempx)
  588. print "Total Reads remaining: "+str$(MAPWIDTH-tempx)
  589. percent#=((tempx*100)/MAPWIDTH)
  590. print "Percent completed "+str$(percent#)
  591. ink rgb(percent#*2, percent#, 255)
  592. box 200, 50, 200+(percent#)*5, 60, 1
  593. ink rgb(0, 255, 0)
  594. box 200, 50, 200+100*5, 60, 0
  595. //drawimage dk_barrel_(dkcoinframe), 180+percent#*5, 20, 1
  596. sync
  597. cls rgb(0,0,0)
  598.  
  599.  
  600.  
  601.  
  602.  
  603. dkcoinframe=dkcoinframe+1
  604.  
  605.  
  606. if dkcoinframe=>7
  607. dkcoinframe=1
  608. endif
  609.  
  610. next tempx
  611.  
  612.  
  613.  
  614. for tempx=1 to MAPWIDTH/2
  615. for tempy=1 to MAPHEIGHT/2
  616. TILEMAP(tempx, tempy)=readint(1)
  617. next tempy
  618. next tempx
  619.  
  620. for temp=1 to 30
  621. b_barrels(temp).facing_type=readint(1)
  622. b_barrels(temp).x1=readint(1)
  623. b_barrels(temp).y1=readint(1)
  624. b_barrels(temp).x2=readint(1)
  625. b_barrels(temp).y2=readint(1)
  626. next temp
  627.  
  628.  
  629. closefile 1
  630.  
  631. falling=true
  632. mode$="playmode"
  633.  
  634. ENDIF
  635.  
  636.  
  637. myimage=newfximage(640, 480)
  638. ;imagemaskcolour myimage, rgb(255, 0, 255) ;purple ish?
  639. rendertoimage myimage
  640. cls rgb(255, 255, 255)
  641. imagemaskcolour myimage, rgb(255, 255, 255); white
  642.  
  643. HEIGHT=500*16
  644. WIDTH=12000
  645.  
  646. rendertoimage castle
  647.  
  648. if grid=true
  649. for tempx=1 to WIDTH/16
  650. for tempy=1 to HEIGHT/16
  651. ink rgb(255,255, 255)
  652. box (tempx-1)*16, (tempy-1)*16, tempx*16, tempy*16, 0
  653. next tempy
  654. next tempx
  655. endif
  656.  
  657.  
  658.  
  659.  
  660. rendertoscreen
  661.  
  662.  
  663.  
  664.  
  665. cameras(currentcamera).x=charx
  666. cameras(currentcamera).y=chary
  667.  
  668.  
  669.  
  670. //stopsound loading;
  671. //playsound loaded;
  672. playsound overworldmusic
  673.  
  674. in_level=false
  675. dixieowframetimer=timer()+30
  676. dixieowframe=1
  677. dixieowx=300
  678. dixieowy=300
  679.  
  680.  
  681. do
  682.  
  683.  
  684. repeating:
  685. if in_level=false
  686.  
  687.  
  688. //we're going to deal with the overworld and only the overworld here
  689.  
  690.  
  691. drawimage quay, 0, 0, 0
  692. drawimage dixieow(dixieowframe), dixieowx, dixieowy, 1
  693.  
  694. if timer()>dixieowframetimer
  695.  
  696. dixieowframetimer=timer()+30
  697. dixieowframe=dixieowframe+1
  698. if dixieowframe>8 then dixieowframe=1
  699.  
  700. endif
  701.  
  702.  
  703.  
  704. ink rgb(255, 255, 255)
  705. text 100, 500, "Test Level. Space to begin"
  706.  
  707. if spacekey()
  708.  
  709. stopsound overworldmusic
  710. playsound loaded
  711.  
  712. cls rgb(0,0,0)
  713. in_level=true
  714. goto start_game
  715. endif
  716.  
  717.  
  718.  
  719. sync
  720. cls rgb(0,0,0)
  721.  
  722. if in_level=false then goto repeating
  723.  
  724.  
  725. endif
  726.  
  727. start_Game:
  728.  
  729.  
  730.  
  731. //if cameras(currentcamera).x<charx then cameras(currentcamera).x=cameras(currentcamera).x+15
  732. //if cameras(currentcamera).x>charx then cameras(currentcamera).x=cameras(currentcamera).x-15
  733. //if cameras(currentcamera).y<chary then cameras(currentcamera).y=cameras(currentcamera).y+15
  734. //if cameras(currentcamera).y>chary then cameras(currentcamera).y=cameras(currentcamera).y-15
  735.  
  736.  
  737.  
  738. scrollimage sky, -1, 0
  739.  
  740.  
  741. if enterkey()
  742. chary=1
  743. scrolly=0
  744. endif
  745.  
  746. if dixieblasted=false
  747. if falling=true
  748. if timer()>falltimer
  749. fallspeed=fallspeed+1
  750. if spinning=true
  751. falltimer=timer()+10
  752. else
  753. falltimer=timer()+5
  754. endif
  755.  
  756. if fallspeed>maxfallspeed then fallspeed=maxfallspeed
  757. endif
  758. endif
  759. endif
  760. if dixieholdingbarrel=true
  761. if spacekey()
  762. if downkey()
  763. puttingdown=true
  764. pickingup=false
  765. endif
  766. endif
  767. endif
  768.  
  769.  
  770.  
  771. ;for temp=1 to 300
  772. ;pushbananaframe(temp)
  773. ;next temp
  774.  
  775. ;if timer()>walltimer
  776. ;walltimer=timer()+wallspeed
  777.  
  778. ;if falling=true
  779. ;if chary=>wally-spriteheight-1
  780. ; chary=wally-spriteheight-1
  781. ;landed=true
  782. ; falling=false
  783. ;onwall=true
  784. ; else
  785. ; onwall=false
  786. ;endif
  787. ;endif
  788.  
  789.  
  790.  
  791.  
  792. if jump=false
  793. if falling=false
  794. if onwall=true
  795. ;chary=chary-1
  796. endif
  797. endif
  798. endif
  799.  
  800. ; wally=wally-1
  801. ;scrolly=scrolly-1
  802.  
  803.  
  804.  
  805.  
  806. if mode$="playmode"
  807. if onwall=true
  808.  
  809. ;pan camera down slowly
  810. if scrolly<wally-400
  811. scrolly=scrolly+2
  812. scrollimage backdrop, 0, -2
  813. scrollimage sky, 0, 1
  814. else
  815. scrolly=wally-400
  816. endif
  817. if scrolly>11776 then scrolly=11776
  818. endif
  819. endif
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827. ;draw map
  828.  
  829.  
  830. ;render to the map image
  831. rendertoscreen
  832.  
  833.  
  834.  
  835. rendertoimage castle
  836.  
  837. x=mousex()
  838. y=mousey()
  839.  
  840. if SCROLLX=>16
  841. amountx=roundup(SCROLLX/16)
  842. else
  843. amountx=1
  844. endif
  845. ;top side same thing as above
  846. if SCROLLY=>16
  847. amounty=roundup(SCROLLY/16)
  848. else
  849. amounty=1
  850. endif
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857. moveright=true
  858. moveleft=true
  859.  
  860. screenx1=amountx
  861. screeny1=amounty
  862. screenx2=32+amountx
  863. screeny2=30+amounty
  864. screenx1=screenx1*16
  865. screeny1=screeny1*16
  866. screenx2=screenx2*16
  867. screeny2=screeny2*16
  868.  
  869.  
  870. for tempx=amountx to 32+amountx ;disable x scroll for this entirely for the right side
  871. for tempy=amounty to 30+amounty
  872.  
  873. x=(tempx-1)*16
  874. y=(tempy-1)*16
  875.  
  876. xdraw=x-SCROLLX
  877. ydraw=y-SCROLLY
  878. ink rgb(0, 255, 0)
  879. ;box x, y, x+16, y+16, 0
  880.  
  881. ;check solid tiles below character
  882.  
  883.  
  884.  
  885. ;check player on tile
  886.  
  887. checkingx=tempx
  888. checkingy=tempy
  889. if checkingx>MAPWIDTH then checkingx=MAPWIDTH
  890. if checkingy>MAPHEIGHT then checkingy=MAPHEIGHT
  891.  
  892. if map(checkingx, checkingy)=1 ;if the tile is solid, check against player collision
  893.  
  894.  
  895. checkingx1=solids(checkingx, checkingy).x1
  896. checkingy1=solids(checkingx, checkingy).y1
  897. checkingx2=solids(checkingx, checkingy).x2
  898. checkingy2=solids(checkingx, checkingy).y2
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907. if dixiemounted=false
  908.  
  909. playerx1=charx
  910. playery1=chary
  911. playerx2=charx+spritewidth
  912. playery2=chary+spriteheight
  913. endif
  914.  
  915. if dixiemounted=true
  916.  
  917. playerx1=rambix
  918. playery1=rambiy
  919. playerx2=rambix+64
  920. playery2=rambiy+64
  921.  
  922. endif
  923.  
  924. //Maybe this will fix the scrolling issues
  925. if crateopened=true
  926. playerx1=squitterx
  927. playery1=squittery
  928. playerx2=squitterx+32
  929. playery2=squittery+32
  930.  
  931. endif
  932.  
  933.  
  934. if spinning=true
  935. gspeed=fallspeed/2
  936. if gspeed>maxhelicopterfall then gspeed=maxhelicopterfall
  937. else
  938. gspeed=fallspeed
  939. endif
  940.  
  941. if dixieblasted=true
  942. if dixieblasteddirection=2
  943. gspeed=dixieblastedspeed+1
  944.  
  945. endif
  946. endif
  947.  
  948.  
  949.  
  950. if playerx2>checkingx1 ;the players x coordinates align
  951. if playerx1<checkingx2
  952. if playery1<checkingy1 ;the players top edge is not past the top of the platform
  953. if playery2>checkingy1-gspeed ;the players bottom edge IS past the top of the platform-1 pixel
  954. landed=true
  955. fallspeed=0
  956. spunalready=false
  957. spinning=false
  958. spinframe=1
  959. spinfallspeed=0
  960. falling=false
  961. dixieblasted=false
  962. dixieblastedspeed=0
  963. dixieblasteddirection=1
  964. jumping=false
  965. endif
  966. endif
  967. endif
  968. endif
  969.  
  970.  
  971.  
  972.  
  973. ;check for left and right sides
  974. ;check left collision (Player is here --> ||Colliding with LEFT wall of object)
  975.  
  976.  
  977. if playerx2>checkingx1-8
  978. if playerx2<checkingx1+8
  979. if playery2>checkingy1
  980. if playery1<checkingy2
  981. moveright=false
  982. else
  983. moveright=true
  984. endif
  985. endif
  986. endif
  987. endif
  988.  
  989. ;check right collision
  990. if playerx1>checkingx2-8
  991. if playerx1<checkingx2+8
  992. if playery2>checkingy1
  993. if playery1<checkingy2
  994. moveleft=false
  995. else
  996. moveleft=true
  997. endif
  998. endif
  999. endif
  1000. endif
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007. endif
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020. if mode$="Collision" ;only place tiles if mode is collision
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026. if mouseinbox(xdraw, ydraw, xdraw+16, ydraw+16)
  1027. if rightmousebutton()
  1028. charx=x
  1029. chary=y
  1030. endif
  1031. endif
  1032.  
  1033.  
  1034. if menu=1
  1035. if leftmousebutton()
  1036. if mouseinbox(xdraw, ydraw,xdraw+16, ydraw+16)
  1037. ;box x, y, x+16, y+16, 0
  1038. map(checkingx, checkingy)=1
  1039. solids(checkingx, checkingy).x1=x
  1040. solids(checkingx, checkingy).y1=y
  1041. solids(checkingx, checkingy).x2=x+16
  1042. solids(checkingx, checkingy).y2=y+16
  1043. endif
  1044. endif
  1045. endif
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051. endif
  1052.  
  1053.  
  1054.  
  1055. next tempy
  1056. next tempx
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062. for temp=1 to 100 ;check barrel collision
  1063.  
  1064.  
  1065.  
  1066.  
  1067. x1=barrels(temp).x1
  1068. y1=barrels(temp).y1
  1069. x2=x1+barrelwidth
  1070. y2=y1+barrelheight
  1071.  
  1072.  
  1073. if mouseinbox(x1-scrollx, y1-scrolly, x2-scrollx, y2-scrolly)
  1074. inbox=true
  1075. lastbarrelx1=x1
  1076. lastbarrely1=y1
  1077. lastbarrelx2=x2
  1078. lastbarrely2=y2
  1079. lastbarrelnumber=temp
  1080.  
  1081. text 200, 570, "Barrel number= "+str$(lastbarrelnumber)
  1082. text 200, 580, "Barrel X1= "+str$(x1) +"Barrel X2= "+str$(x2)
  1083. text 200, 590, "Barrel Y1= "+str$(y1) +"Barrel Y2= "+str$(y2)
  1084. if spacekey()
  1085. barrels(temp).x1=mousex()+scrollx-20
  1086. barrels(temp).y1=mousey()+scrolly-20
  1087. endif
  1088. endif
  1089.  
  1090.  
  1091.  
  1092.  
  1093. amountx=x1
  1094. amounty=y1
  1095. amountx=roundup(amountx/16) ;get the tile number of x
  1096. amounty=roundup(amounty/16) ;get the tile number of y
  1097.  
  1098. for tempx=amountx-3 to amountx+3
  1099. for tempy=amounty-3 to amounty+3
  1100.  
  1101. checkingx=tempx
  1102. checkingy=tempy
  1103. if checkingx>MAPWIDTH then checkingx=MAPWIDTH
  1104. if checkingy>MAPHEIGHT then checkingy=MAPHEIGHT
  1105.  
  1106. if checkingx<1 then checkingx=1
  1107. if checkingy<1 then checkingy=1
  1108.  
  1109. if map(checkingx, checkingy)=1 ;if the tile is solid, check against player collision
  1110.  
  1111.  
  1112. checkingx1=solids(checkingx, checkingy).x1
  1113. checkingy1=solids(checkingx, checkingy).y1
  1114. checkingx2=solids(checkingx, checkingy).x2
  1115. checkingy2=solids(checkingx, checkingy).y2
  1116.  
  1117. bspeed=barrels(temp).fallspeed
  1118. ;only try to handle barrels on screen
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125. if x2>checkingx1
  1126. if x1<checkingx2
  1127. if y1<checkingy1
  1128. if y2>checkingy1-checkspeed
  1129. barrels(temp).landed=true
  1130. barrels(temp).fallspeed=1
  1131. barrels(temp).falling=false
  1132. barrels(temp).state=2
  1133. endif
  1134. endif
  1135. endif
  1136. endif
  1137. endif
  1138.  
  1139. next tempy
  1140. next tempx
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147. playerx1=charx
  1148. playery1=chary
  1149. playerx2=charx+spritewidth
  1150. playery2=chary+spriteheight
  1151.  
  1152.  
  1153. if dixieaction=1 ;facing right
  1154.  
  1155.  
  1156.  
  1157.  
  1158. if playerx2>x1-3
  1159. if playerx2<x1+3
  1160. if playery2>y1
  1161. if playery1<y2
  1162. if spacekey() ;check if dixie is on right side of barrel and holding space key
  1163. if landed=true
  1164. dixieholdingbarrel=true
  1165. barrels(temp).draw=false
  1166. dixiepickupbarrelframe=1
  1167. pickingup=true
  1168. pickedupbarrel=temp
  1169. endif
  1170. endif
  1171. endif
  1172. endif
  1173. endif
  1174. endif
  1175.  
  1176.  
  1177. endif
  1178.  
  1179.  
  1180. if dixieaction=2 ;facing left
  1181.  
  1182.  
  1183. if playerx1>x2-3
  1184. if playerx1<x2+3
  1185. if playery2>y1
  1186. if playery1<y2
  1187. if spacekey() ;check if dixie is on left side of barrel and holding space key
  1188. if landed=true
  1189. dixieholdingbarrel=true
  1190. barrels(temp).draw=false
  1191. dixiepickupbarrelframe=1
  1192. pickingup=true
  1193. pickedupbarrel=temp
  1194.  
  1195. endif
  1196. endif
  1197. endif
  1198. endif
  1199. endif
  1200. endif
  1201.  
  1202. endif
  1203.  
  1204.  
  1205.  
  1206.  
  1207. next temp
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216. if mode$<>"playmode"
  1217. if rightkey()
  1218. scrollx=scrollx+12
  1219. scrollimage backdrop, -6, 0
  1220. scrollimage sky, -3, 0
  1221.  
  1222. endif
  1223.  
  1224. if leftkey()
  1225. scrollx=scrollx-12
  1226. scrollimage backdrop, 6, 0
  1227. scrollimage sky, 3, 0
  1228. endif
  1229.  
  1230. endif
  1231.  
  1232.  
  1233.  
  1234.  
  1235. if falling=true ; set the spinning flag if falling and upkey is pressed
  1236. if spinning=false
  1237. if spunalready=false
  1238. if landed=false
  1239. if spacekey()
  1240. spinning=true
  1241. spunalready=true
  1242. oldfallspeed=fallspeed
  1243. fallspeed=1
  1244. endif
  1245. endif
  1246. endif
  1247. endif
  1248. endif
  1249.  
  1250.  
  1251. ; if upkey is held player is spinning
  1252. if falling=true or jump=true
  1253. if spinning=true
  1254. if spunalready=true
  1255. if landed=false
  1256. if spacekey()
  1257. spinning=true
  1258. oldfallspeed=fallspeed
  1259. jump=false
  1260. else
  1261. spinning=false
  1262. fallspeed=oldfallspeed
  1263. endif
  1264. endif
  1265. endif
  1266. endif
  1267. endif
  1268.  
  1269.  
  1270.  
  1271. if spinning=true
  1272. if timer()>spinframetimer
  1273. spinframetimer=timer()+30
  1274. spinframe=spinframe+1
  1275. if spinframe>10 then spinframe=1
  1276. endif
  1277. endif
  1278.  
  1279.  
  1280. if dixieholdingbarrel=true ;this handles dixie's frame animations for her facing right direction while picking up a barrel!
  1281. if pickingup=true
  1282.  
  1283. if dixiepickupbarrelframe<14 ;she can't move while picking things up!!! silly dixie kong
  1284. moveright=false
  1285. moveleft=false
  1286. jump=false
  1287. jumptime=0
  1288. else
  1289. moveright=true
  1290. endif
  1291.  
  1292.  
  1293. if timer()>bholdframetimer
  1294. bholdframetimer=timer()+30
  1295. dixiepickupbarrelframe=dixiepickupbarrelframe+1
  1296. endif
  1297.  
  1298. if dixiepickupbarrelframe>14 then dixiepickupbarrelframe=14
  1299. endif
  1300.  
  1301.  
  1302. endif
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309. if puttingdown=true
  1310.  
  1311. if dixiepickupbarrelframe>1
  1312. moveright=false
  1313. moveleft=false
  1314. jump=false
  1315. jumptime=0
  1316. else
  1317. moveright=true
  1318. moveleft=true
  1319. endif
  1320.  
  1321. if timer()>bholdframetimer
  1322. bholdframetimer=timer()+30
  1323. dixiepickupbarrelframe=dixiepickupbarrelframe-1
  1324. endif
  1325.  
  1326. if dixiepickupbarrelframe<=1
  1327. dixiepickupbarrelframe=1
  1328. dixieholdingbarrel=false
  1329. puttingdown=false
  1330. pickingup=false
  1331. if dixieaction=1 ;facing right
  1332. barrels(pickedupbarrel).x1=charx+spritewidth-6
  1333. barrels(pickedupbarrle).state=2
  1334. else
  1335. if dixieaction=2 ;facing left
  1336. barrels(pickedupbarrel).x1=charx-spritewidth+6
  1337. barrels(pickedupbarrel).state=2
  1338. endif
  1339. endif
  1340. barrels(pickedupbarrel).y1=chary-spriteheight+8
  1341. barrels(pickedupbarrel).draw=true
  1342. barrels(pickedupbarrel).falling=true
  1343. barrels(pickedupbarrel).landed=false
  1344. endif
  1345.  
  1346.  
  1347.  
  1348. endif
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355. if mode$="playmode"
  1356. if jump=false
  1357. if landed=false
  1358. if dixieblasted=false
  1359. ;handle character falling
  1360. if falling=true
  1361.  
  1362. if spinning=true
  1363. spinfallspeed=fallspeed/2
  1364.  
  1365. ;quick patch fall speed to max helicopter speed
  1366.  
  1367. ;only fall if dixieblasted=false
  1368.  
  1369. if spinfallspeed>maxhelicopterfall then spinfallspeed=maxhelicopterfall
  1370.  
  1371.  
  1372. chary=chary+spinfallspeed
  1373. else
  1374. chary=chary+fallspeed
  1375.  
  1376. if dixiemounted=true
  1377. rambiy=rambiy+fallspeed
  1378.  
  1379. if inkey$()=" "
  1380. dixiemounted=false
  1381. endif
  1382.  
  1383.  
  1384. endif
  1385.  
  1386. if crateopened=true
  1387. squittery=squittery+fallspeed
  1388. endif
  1389.  
  1390.  
  1391.  
  1392. endif
  1393.  
  1394.  
  1395. if chary=>480/2 ;sloppy attempt at keeping the player centered on camera
  1396.  
  1397. if spinning=false
  1398. scrolly=scrolly+fallspeed
  1399. scrollimage backdrop, 0, -fallspeed
  1400. scrollimage sky, 0, -fallspeed/2
  1401. else
  1402. scrolly=scrolly+spinfallspeed
  1403. scrollimage backdrop, 0, -spinfallspeed
  1404. scrollimage sky, 0, -spinfallspeed/2
  1405. endif
  1406. endif
  1407.  
  1408. endif
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416. endif ;only execute character falling code if landed is false.
  1417. endif
  1418.  
  1419. endif ;end the code for jumping
  1420.  
  1421.  
  1422. endif
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428. ink rgb(0, 0, 255); blue
  1429.  
  1430.  
  1431. ink rgb(255, 255, 255)
  1432.  
  1433.  
  1434.  
  1435. ;for temp=1 to roundup(640/163)
  1436. ;drawimage wall, (temp-1)*163, wally, 0
  1437. ;next temp
  1438.  
  1439.  
  1440.  
  1441.  
  1442. ;rendertoimage myimage
  1443.  
  1444.  
  1445. ;getimage myimage, 0+scrollx, 0+scrolly, 640+scrollx , 480+scrolly
  1446.  
  1447.  
  1448.  
  1449. ;make sure it doesn't scroll past the left or right side too far
  1450. if scrollx<=0 then scrollx=0
  1451. ;if scrollx+640=>WIDTH then scrollx=WIDTH-640
  1452.  
  1453. ;make sure it doesn't scroll past the top or bottom side too far
  1454. if scrolly<=0 then scrolly=0
  1455. if scrolly+480=>HEIGHT then scrolly=HEIGHT-480
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461. rendertoscreen
  1462. ;box charx, chary, charx+16, chary+16, 0
  1463.  
  1464. if dixiemounted=true //this should patch it
  1465. charx=rambix // so that the engine
  1466. chary=rambiy-32 //indirectly changes dixie's coordinates
  1467. endif //in the case she is riding rambi WHAT A CLUSTER FUCK OF CODE THIS HAS BECOME
  1468.  
  1469.  
  1470. if crateopened=true
  1471. squitterx=charx
  1472. squittery=chary
  1473. endif
  1474.  
  1475.  
  1476.  
  1477. charx1=charx
  1478. chary1=chary
  1479. charx2=charx+spritewidth
  1480. chary2=chary+spriteheight
  1481. charx1=charx1-scrollx
  1482. chary1=chary1-scrolly
  1483. charx2=charx2-scrollx
  1484. chary2=chary2-scrolly
  1485.  
  1486.  
  1487.  
  1488.  
  1489. for tempx=1 to 2
  1490. for tempy=1 to 2
  1491. drawimage sky, (tempx-1)*256, (tempy-1)*256, 0
  1492. drawimage backdrop, (tempx-1)*256, (tempy-1)*256, 1
  1493. next tempy
  1494. next tempx
  1495.  
  1496.  
  1497.  
  1498. drawimage myimage, 0, 0, 1
  1499. drawimage mode, 0, 500, 0
  1500. drawimage save, 0, 600, 0
  1501. drawimage playmode, 0, 700, 0
  1502.  
  1503. if timer()>bananatimer
  1504. bananatimer=timer()+30
  1505. pushframes=true
  1506. endif
  1507.  
  1508. //Let's just shorten this more and we'll seperate bananas even more later ^^;
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515. amountx=roundup(tileboxoffsetx/32)
  1516. if amountx<1 then amountx=1
  1517. ink rgb(255, 0, 0)
  1518. tile_to_draw=amountx*26
  1519. for tempx=amountx to 23+amountx
  1520. for tempy=1 to 26
  1521. if tile_to_draw>598 then tile_to_draw=598
  1522. if tile_to_draw<1 then tile_to_draw=1
  1523.  
  1524. if menu=1
  1525. drawimage tiles(tile_to_draw), (tempx-1)*32+530-tileboxoffsetx, (tempy-1)*32-tileboxoffset, 0
  1526. endif
  1527.  
  1528.  
  1529. ;dx1=((tempx-1)*32)+530-tileboxoffsetx
  1530. ;dy1=(tempy-1)*32-tileboxoffset
  1531. ;dx2=(tempx*32)+530-tileboxoffsetx
  1532. ;dy2=tempy*32-tileboxoffset
  1533. ;boxc dx1, dy1, dx2, dy2, 0, rgb(255, 0, 0)
  1534.  
  1535. if mouseinbox( ((tempx-1)*32)+530-tileboxoffsetx, (tempy-1)*32-tileboxoffset, (tempx*32)+530-tileboxoffsetx, tempy*32-tileboxoffset )
  1536. if leftmousebutton()
  1537. if menu=1
  1538. currenttile=tile_to_draw
  1539. endif
  1540. endif
  1541.  
  1542. if keystate(29) ;left control key
  1543.  
  1544.  
  1545. if leftmousebutton()
  1546. if menu=1
  1547.  
  1548. if multiple_selected=false
  1549. multiple_selected=true
  1550. tiles_selected=1
  1551. dim tiles_list(1)
  1552. tiles_list(tiles_selected)=tile_to_draw
  1553. endif
  1554.  
  1555. if last_tile<>tile_to_draw
  1556.  
  1557. tiles_list(tiles_selected)=tile_to_draw
  1558. last_tile=tile_to_draw
  1559. tiles_selected=tiles_selected+1
  1560. redim tiles_list(tiles_selected)
  1561. endif
  1562.  
  1563. endif
  1564. endif
  1565. endif
  1566.  
  1567.  
  1568.  
  1569.  
  1570. endif
  1571. tile_to_draw=tile_to_draw+1
  1572.  
  1573. next tempy
  1574. next tempx
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582. if SCROLLX=>16
  1583. amountx=roundup(SCROLLX/16)
  1584. else
  1585. amountx=1
  1586. endif
  1587. ;top side same thing as above
  1588. if SCROLLY=>16
  1589. amounty=roundup(SCROLLY/16)
  1590. else
  1591. amounty=1
  1592. endif
  1593.  
  1594. if 32+amountx>MAPWIDTH
  1595. MAPWIDTH=32+amountx
  1596. redim map(MAPWIDTH, MAPHEIGHT)
  1597. endif
  1598.  
  1599. if 30+amounty>MAPHEIGHT
  1600. MAPHEIGHT=32+amounty
  1601. redim map(MAPWIDTH, MAPHEIGHT)
  1602. endif
  1603.  
  1604.  
  1605. for tempx=amountx to 32+amountx ;disable x scroll for this entirely for the right side
  1606. for tempy=amounty to 30+amounty
  1607.  
  1608. draw=map(tempx, tempy)
  1609.  
  1610. if draw=1
  1611.  
  1612. x=(tempx-1)*16
  1613. y=(tempy-1)*16
  1614.  
  1615. xdraw=x-SCROLLX
  1616. ydraw=y-SCROLLY
  1617. ink rgb(0, 255, 0)
  1618. box xdraw, ydraw, xdraw+16, ydraw+16, 0
  1619. endif
  1620.  
  1621.  
  1622. next tempy
  1623. next tempx
  1624.  
  1625.  
  1626.  
  1627.  
  1628. if SCROLLX=>32
  1629. amountx=roundup(SCROLLX/32)
  1630. else amountx=1
  1631. endif
  1632. ;top side same thing as above
  1633. if SCROLLY=>32
  1634. amounty=roundup(SCROLLY/32)
  1635. else
  1636. amounty=1
  1637. endif
  1638.  
  1639. if 17+amountx>MAPWIDTH/2
  1640. redim tilemap(amountx+17, MAPHEIGHT/2)
  1641. endif
  1642.  
  1643. if 16+amounty>MAPHEIGHT/2
  1644. redim tilemap(MAPWIDTH/2, amounty+16)
  1645. endif
  1646.  
  1647.  
  1648. for tempx=amountx to amountx+17
  1649. for tempy=amounty to amounty+16
  1650.  
  1651.  
  1652. x=(tempx-1)*32
  1653. y=(tempy-1)*32
  1654.  
  1655. xdraw=x-SCROLLX
  1656. ydraw=y-SCROLLY
  1657.  
  1658. if TILEMAP(tempx, tempy)>0
  1659.  
  1660. tile_this_tile=TILEMAP(tempx, tempy)
  1661.  
  1662. drawimage tiles(tile_this_tile), xdraw, ydraw, 1
  1663. endif
  1664.  
  1665. if mode$="tile_mode"
  1666.  
  1667. if mouseinbox(0 ,0 ,500, 480)
  1668. if mouseinbox( xdraw, ydraw, xdraw+32, ydraw+32 )
  1669. if leftmousebutton()
  1670. TILEMAP(tempx, tempy)=currenttile
  1671.  
  1672. if multiple_selected=true
  1673. amount=tiles_selected
  1674. for temp=1 to amount
  1675. to_draw=tiles_list(temp)
  1676. if to_draw<1 then to_draw=1
  1677. TILEMAP(tempx-1+temp, tempy)=to_draw
  1678. next temp
  1679. endif
  1680.  
  1681.  
  1682.  
  1683.  
  1684. endif
  1685. endif
  1686. ;sync
  1687. endif
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693. endif
  1694.  
  1695.  
  1696.  
  1697. next tempy
  1698. next tempx
  1699.  
  1700. if multiple_selected=true
  1701. amount=tiles_selected
  1702. for temp=1 to amount
  1703. to_draw=tiles_list(temp)
  1704. if to_draw<1 then to_draw=1
  1705. drawimage tiles(to_draw), mousex()+(temp-1)*32, mousey(), 1
  1706.  
  1707. next temp
  1708. endif
  1709.  
  1710. if keystate(157)
  1711. multiple_selected=false
  1712. endif
  1713.  
  1714.  
  1715.  
  1716. ink rgb(0, 0, 255) ;blue character
  1717. ;box charx1, chary1, charx2, chary2, 1
  1718. ;;
  1719.  
  1720. if dixiemounted=false
  1721. boxx1=charx1
  1722. boxy1=chary1
  1723. boxx2=charx2
  1724. boxy2=chary2
  1725. endif
  1726.  
  1727. if dixiemounted=true
  1728. boxx1=rambix
  1729. boxy1=rambiy
  1730. boxx2=rambix+64
  1731. boxy2=rambiy+64
  1732. boxx1=boxx1-scrollx
  1733. boxy1=boxy1-scrolly
  1734. boxx2=boxx2-scrollx
  1735. boxy2=boxy2-scrolly
  1736. endif
  1737.  
  1738. if crateopened=true
  1739. boxx1=squitterx
  1740. boxy1=squittery
  1741. boxx2=squitterx+32
  1742. boxy2=squittery+32
  1743. boxx1=boxx1-scrollx
  1744. boxy1=boxy1-scrolly
  1745. boxx2=boxx2-scrollx
  1746. boxy2=boxy2-scrolly
  1747. endif
  1748.  
  1749.  
  1750.  
  1751.  
  1752. box boxx1, boxy1, boxx2, boxy2, 0
  1753.  
  1754.  
  1755.  
  1756. if dixiemounted=false
  1757. if dixieaction=1 ;only draw if dixie is facing right
  1758. if dixieholdingbarrel=true
  1759. drawimage dixiepickupbarrelright(dixiepickupbarrelframe), charx1, chary1-48, 1
  1760. endif
  1761. endif
  1762. endif
  1763.  
  1764. if dixiemounted=false
  1765. if dixieholdingbarrel=false
  1766. if dixieaction=1
  1767. if landed=true
  1768. drawimage dixieright(dixieframe), charx1, chary1-spriteheight/2, 1
  1769. else
  1770.  
  1771.  
  1772. if jump=true
  1773. drawimage dixiejumpright(jumpframe), charx1, chary1-36, 1
  1774. else
  1775. if spinning=false
  1776. drawimage dixiejumpright(4), charx1, chary1-36, 1
  1777. else
  1778.  
  1779. drawimage dixiespinright(spinframe), charx1, chary1-spriteheight/2, 1
  1780.  
  1781. endif
  1782. endif
  1783. endif
  1784. endif
  1785. endif
  1786. endif
  1787.  
  1788.  
  1789. if dixiemounted=false
  1790. if dixieaction=2 ;only draw if dixie is facing left
  1791. if dixieholdingbarrel=true
  1792. drawimage dixiepickupbarrelleft(dixiepickupbarrelframe), charx1-spritewidth, chary1-48, 1
  1793. endif
  1794. endif
  1795. endif
  1796.  
  1797. if dixiemounted=false
  1798. if dixieholdingbarrel=false
  1799. if dixieaction=2
  1800. if landed=true
  1801. drawimage dixieleft(dixieframe), charx1-16, chary1-spriteheight/2, 1
  1802. else
  1803. if jump=true
  1804. drawimage dixiejumpleft(jumpframe), charx1-16, chary1-36, 1
  1805. else
  1806. if spinning=false
  1807. drawimage dixiejumpleft(4), charx1-16, chary1-36, 1
  1808. else
  1809.  
  1810. drawimage dixiespinleft(spinframe), charx1, chary1-spriteheight/2, 1
  1811.  
  1812. endif
  1813. endif
  1814. endif
  1815. endif
  1816. endif
  1817. endif
  1818.  
  1819. ink rgb(0, 255, 255) ;white
  1820.  
  1821. if dixiemounted=false
  1822. drawimage rambi_run_right(1), rambix-scrollx, rambiy-scrolly, 1
  1823. endif
  1824.  
  1825.  
  1826. if dixiemounted=true
  1827.  
  1828. if dixieaction=1
  1829. drawimage rambi_run_right(rambiframe), rambix-scrollx, rambiy-scrolly, 1
  1830. drawimage dixiemountedright, rambix-scrollx, rambiy-spriteheight-scrolly, 1
  1831. endif
  1832.  
  1833. if dixieaction=2
  1834. drawimage rambi_run_left(rambiframe), rambix-scrollx, rambiy-scrolly, 1
  1835. drawimage dixiemountedleft, rambix-scrollx, rambiy-spriteheight-scrolly, 1
  1836. endif
  1837.  
  1838. endif
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845. checkingx1=charx
  1846. checkingy1=chary
  1847. checkingx2=charx+spritewidth
  1848. checkingy2=chary+spriteheight
  1849.  
  1850. if checkingx2>rambix
  1851. if checkingx1<rambix+32
  1852.  
  1853. if checkingy2>rambiy
  1854. if checkingy1<rambiy+32
  1855.  
  1856. dixiemounted=true
  1857. endif
  1858. endif
  1859. endif
  1860. endif
  1861.  
  1862.  
  1863.  
  1864. //Here we're going to check for collision with the squitter rate
  1865.  
  1866. //
  1867.  
  1868. if falling=true //We only want this to work if dixie is falling.
  1869. if checkingx2>squitterCrateX
  1870. if checkingx1<squittercrateX+106
  1871. if checkingy2>squitterCrateY
  1872. if checkingY1<SquitterCrateY+60
  1873.  
  1874. //Summon Squitter!!!
  1875. CrateOpened=true
  1876.  
  1877. //This will only happen on the first frame
  1878. if squittercrateframe<2
  1879. SquitterX=SquitterCrateX+50
  1880. SquitterY=SquitterCrateY
  1881. //falling=false
  1882. //landed=true
  1883. //dixieblasted=true
  1884. //dixieblastedspeed=11
  1885. //dixieblasteddirection=1
  1886. endif
  1887.  
  1888.  
  1889.  
  1890. //This check should stop the sound from looping
  1891. //Even if the collision still happens! That would've sucked huh?
  1892. if squittercrateframe<2
  1893. playsound Crateopens;
  1894. endif
  1895.  
  1896. endif
  1897. endif
  1898. endif
  1899. endif
  1900. endif
  1901.  
  1902.  
  1903. //Directly below here we deal with the crate opening
  1904.  
  1905. if CrateOpened=true
  1906. if squittercrateframe<3 then squittercrateframe=Squittercrateframe+1
  1907. endif
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915. if keystate(72)
  1916. tileboxoffset=tileboxoffset-5
  1917. endif
  1918.  
  1919. if keystate(80)
  1920. tileboxoffset=tileboxoffset+5
  1921. endif
  1922.  
  1923.  
  1924. if keystate(77)
  1925. tileboxoffsetx=tileboxoffsetx+5
  1926. endif
  1927.  
  1928. if keystate(75)
  1929. tileboxoffsetx=tileboxoffsetx-5
  1930. endif
  1931.  
  1932. if keystate(42)
  1933. menu=menu-1
  1934. endif
  1935.  
  1936. if keystate(54)
  1937. menu=menu+1
  1938. endif
  1939.  
  1940. if menu<1 then menu=1
  1941. if menu>2 then menu=2
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948. text 200, 500, "SCROLLY " +str$(Scrolly)+" --ROUNDED to tile index: "+str$(amounty)
  1949. text 200, 520, "SCROLLX " +str$(Scrollx)+" --ROUNDED to tile index: "+str$(amountx)
  1950. text 200, 540, "This is the result of WIDTH <> scroll X"+str$(WIDTH-(640+scrollx))+"and"+str$(WIDTH)
  1951. text 200, 560, "Playerx : "+str$(charx)+" Playery : "+str$(chary)
  1952.  
  1953.  
  1954. if inbox=true
  1955. text 200, 570, "Barrel number= "+str$(lastbarrelnumber)
  1956. text 200, 580, "Barrel X1= "+str$(x1) +"Barrel X2= "+str$(x2)
  1957. text 200, 590, "Barrel Y1= "+str$(y1) +"Barrel Y2= "+str$(y2)
  1958. endif
  1959.  
  1960. text 200, 600, "RambiX= "+str$(rambix) + "RambiY= "+str$(rambiy)
  1961.  
  1962. box (mousex()), (mousey()), mousex()+32, mousey()+32, 0
  1963.  
  1964.  
  1965.  
  1966. if mouseinbox(0, 500, 0+128, 564)
  1967. if leftmousebutton()
  1968. mode$="Collision"
  1969. endif
  1970. endif
  1971.  
  1972. if mouseinbox(0, 700, 0+(128*3), 764)
  1973. if leftmousebutton()
  1974. mode$="playmode"
  1975. falling=true
  1976. endif
  1977. endif
  1978.  
  1979.  
  1980. if mouseinbox(0, 600, 0+(128*2), 664)
  1981. if leftmousebutton()
  1982.  
  1983. if fileexist("C:/brambles_map3.txt")
  1984. deletefile ("C:/brambles_map3.txt")
  1985. endif
  1986.  
  1987.  
  1988. writefile "levels\brambles_map3.txt", 1
  1989.  
  1990. writeint 1, Mapwidth
  1991. writeint 1, mapheight
  1992. writeint 1, charx
  1993. writeint 1, chary
  1994. writeint 1, scrollx
  1995. writeint 1, scrolly
  1996.  
  1997. for tempx=1 to Mapwidth
  1998. for tempy=1 to mapheight
  1999. writeint 1, map(tempx, tempy)
  2000. writeint 1, solids(tempx, tempy).x1
  2001. writeint 1, solids(tempx, tempy).y1
  2002. writeint 1, solids(tempx, tempy).x2
  2003. writeint 1, solids(tempx, tempy).y2
  2004. next tempy
  2005. next tempx
  2006.  
  2007. for tempx=1 to MAPWIDTH/2
  2008. for tempy=1 to MAPHEIGHT/2
  2009. writeint 1, TILEMAP(tempx, tempy)
  2010. next tempy
  2011. next tempx
  2012.  
  2013. for temp=1 to 30
  2014. writeint 1, b_barrels(temp).facing_type
  2015. writeint 1, b_barrels(temp).x1
  2016. writeint 1, b_barrels(temp).y1
  2017. writeint 1, b_barrels(temp).x2
  2018. writeint 1, b_barrels(temp).y2
  2019. next temp
  2020.  
  2021. closefile 1
  2022.  
  2023.  
  2024. endif
  2025. endif
  2026.  
  2027.  
  2028.  
  2029. ;scrolling input
  2030.  
  2031.  
  2032.  
  2033. if dixiemounted=false
  2034. if leftkey()
  2035. ;scrollx=scrollx-8
  2036. dixieaction=2
  2037.  
  2038.  
  2039. if timer()>frametimer
  2040. dixieframe=dixieframe+1
  2041.  
  2042. if dixieframe>16 then dixieframe=1
  2043. frametimer=timer()+30
  2044. endif
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. if moveleft=true
  2051.  
  2052.  
  2053. charx=charx-8
  2054. if charx>320
  2055. if charx<WIDTH-320
  2056. scrollimage backdrop, 4, 0
  2057. scrollimage sky, 2, 0
  2058. endif
  2059. endif
  2060.  
  2061. ;scrollx=scrollx-1
  2062.  
  2063. endif
  2064. endif
  2065. endif
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071. if dixiemounted=false
  2072. if rightkey()
  2073. ;scrollx=scrollx+8
  2074. dixieaction=1
  2075.  
  2076. if timer()>frametimer
  2077. dixieframe=dixieframe+1
  2078.  
  2079. if dixieframe>16 then dixieframe=1
  2080. frametimer=timer()+30
  2081. endif
  2082.  
  2083. if moveright=true
  2084.  
  2085.  
  2086. charx=charx+8
  2087. if charx<WIDTH-320
  2088. if charx>320
  2089. scrollimage backdrop, -4, 0
  2090. scrollimage sky, -2, 0
  2091. endif
  2092. endif
  2093.  
  2094. ;scrollx=scrollx+1
  2095.  
  2096.  
  2097. endif
  2098. endif
  2099. endif
  2100.  
  2101.  
  2102.  
  2103.  
  2104. //the above was the movement code for dixie not being mounted.
  2105.  
  2106. //here is the code for when dixie is mounted
  2107.  
  2108.  
  2109.  
  2110.  
  2111. if dixiemounted=true
  2112. if leftkey()
  2113. ;scrollx=scrollx-8
  2114. dixieaction=2
  2115.  
  2116.  
  2117. if timer()>frametimer
  2118. rambiframe=rambiframe+1
  2119.  
  2120. if rambiframe>15 then rambiframe=1
  2121. frametimer=timer()+30
  2122. endif
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128. //if moveleft=true
  2129.  
  2130.  
  2131. rambix=rambix-8
  2132. charx=charx-8
  2133. if rambix>320
  2134. if rambix<WIDTH-320
  2135. scrollimage backdrop, 4, 0
  2136. scrollimage sky, 2, 0
  2137. endif
  2138. endif
  2139.  
  2140. ;scrollx=scrollx-1
  2141.  
  2142. endif
  2143. endif
  2144. //endif
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152. if dixiemounted=true
  2153. if rightkey()
  2154. ;scrollx=scrollx+8
  2155. dixieaction=1
  2156.  
  2157. if timer()>frametimer
  2158. rambiframe=rambiframe+1
  2159.  
  2160. if rambiframe>15 then rambiframe=1
  2161. frametimer=timer()+30
  2162. endif
  2163.  
  2164. //if moveright=true
  2165.  
  2166.  
  2167. rambix=rambix+8
  2168. charx=charx+8
  2169. if rambix<WIDTH-320
  2170. if rambix>320
  2171. scrollimage backdrop, -4, 0
  2172. scrollimage sky, -2, 0
  2173. endif
  2174. endif
  2175.  
  2176. ;scrollx=scrollx+1
  2177.  
  2178.  
  2179. //endif
  2180. endif
  2181. endif
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187. //on rambi
  2188.  
  2189.  
  2190. //now on squitter
  2191.  
  2192.  
  2193. if openedcrate=true
  2194.  
  2195. if rightkey()
  2196. if dixieaction=1
  2197.  
  2198. //if moveright=true
  2199. squitterx=squitterx+8
  2200. charx=charx+8
  2201. squitterframe=squitterframe+1
  2202.  
  2203. //endif
  2204. endif
  2205. endif
  2206.  
  2207.  
  2208.  
  2209. if leftkey()
  2210. if dixieaction=2
  2211.  
  2212. //if moveleft=true
  2213. squitterx=squitterx-8
  2214. charx=charx-8
  2215.  
  2216. //endif
  2217. endif
  2218. endif
  2219.  
  2220.  
  2221.  
  2222.  
  2223. endif
  2224. //End checking if the crate is opened here
  2225.  
  2226.  
  2227.  
  2228. if mode$<>"playmode"
  2229.  
  2230. if downkey()
  2231. scrolly=scrolly+12
  2232. scrollimage backdrop, 0, -6
  2233. scrollimage sky, 0, -3
  2234. endif
  2235.  
  2236. if upkey()
  2237. scrolly=scrolly-12
  2238. scrollimage backdrop, 0, 6
  2239. scrollimage sky, 0, 3
  2240. endif
  2241.  
  2242. endif
  2243.  
  2244.  
  2245.  
  2246. if mode$="playmode"
  2247.  
  2248.  
  2249. if jump=false
  2250. if upkey()
  2251. if landed=true
  2252. jump=true
  2253. upforce=30
  2254. jumpframetimer=timer()+30
  2255. endif
  2256. endif
  2257. endif
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264. if jump=true
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270. if dixiemounted=true
  2271. chary=chary-(upforce*0.60)
  2272. rambiy=rambiy-(upforce*0.60)
  2273. scrolly=scrolly-(upforce*0.60)
  2274. scrollimage backdrop, 0, (upforce*0.60)/2
  2275. scrollimage sky, 0, (upforce*0.60)/4
  2276. upforce=upforce-2
  2277.  
  2278. endif
  2279.  
  2280. if crateopened=true
  2281. chary=chary-(upforce*0.6)
  2282. squittery=squittery-(upforce*0.060)
  2283. scrolly=scrolly-(upforce*0.60)
  2284. upforce=upforce-2
  2285. endif
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292. if dixiemounted=false
  2293. chary=chary-(upforce*0.60)
  2294. scrolly=scrolly-(upforce*0.60)
  2295. scrollimage backdrop, 0, (upforce*0.60)/2
  2296. scrollimage sky, 0, (upforce*0.60)/4
  2297. upforce=upforce-2
  2298. endif
  2299.  
  2300. if timer()>jumpframetimer
  2301. jumpframe=jumpframe+1
  2302. if jumpframe>4 then jumpframe=4
  2303. jumpframetimer=timer()+30
  2304. endif
  2305. endif
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311. state=upkey()
  2312.  
  2313. if state=false
  2314. upforce=0
  2315. endif
  2316.  
  2317.  
  2318. if jump=true
  2319. if upforce=<0
  2320. jump=false
  2321. upforce=0
  2322. fallspeed=7
  2323. endif
  2324. endif
  2325.  
  2326.  
  2327.  
  2328. endif
  2329.  
  2330.  
  2331.  
  2332. falling=true
  2333. landed=false
  2334. ;moveright=true
  2335.  
  2336.  
  2337.  
  2338. ;draw barrels
  2339. for temp=1 to 100
  2340. x=barrels(temp).x1
  2341. y=barrels(temp).y1
  2342. bfalling=barrels(temp).falling
  2343. blanded=barrels(temp).landed
  2344. draw=barrels(temp).draw
  2345. btimer=barrels(temp).falltimer
  2346. state=barrels(temp).state
  2347. frame=barrels(temp).frame
  2348. tmr=barrels(temp).frametimer
  2349.  
  2350.  
  2351.  
  2352. if blanded=false
  2353. if bfalling=true
  2354.  
  2355.  
  2356. if timer()>btimer
  2357. barrels(temp).falltimer=timer()+100
  2358. barrels(temp).fallspeed=barrels(temp).fallspeed+1
  2359. if barrels(temp).fallspeed>3 then barrels(temp).fallspeed=3
  2360. endif
  2361.  
  2362. bfallspeed=barrels(temp).fallspeed
  2363. barrels(temp).y1=barrels(temp).y1+bfallspeed
  2364.  
  2365. endif
  2366. endif
  2367.  
  2368. if timer()>tmr
  2369. barrels(temp).frame=barrels(temp).frame-1
  2370. if barrels(temp).frame<1 then barrels(temp).frame=7
  2371. if blanded=true or blanded=1 then barrels(temp).x1=barrels(temp).x1+8
  2372. endif
  2373.  
  2374.  
  2375.  
  2376. if draw=true
  2377.  
  2378. if state=1
  2379. drawimage barreli, x-scrollx, y-scrolly, 1
  2380. endif
  2381.  
  2382. if state=2
  2383. drawimage rolling_barrel(frame), x-scrollx, y-scrolly, 1
  2384. endif
  2385.  
  2386.  
  2387. endif
  2388.  
  2389.  
  2390.  
  2391. next temp
  2392.  
  2393.  
  2394. //Here I want to deal with the crate
  2395.  
  2396. //We'll just make sure the crate frame does not exceed 2 frames
  2397. if SquitterCrateFrame>3 then SquitterCrateFrame=2;
  2398.  
  2399. drawimage squittercrate(SquitterCrateFrame), SquitterCrateX-scrollx, SquitterCrateY-scrolly, 1
  2400. drawimage squitterwalkright(squitterframe), SquitterX-scrollx, Squittery-scrolly, 1
  2401. squitterframe=squitterframe+1
  2402.  
  2403.  
  2404.  
  2405. if squitterframe=>16 then squitterframe=1
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415. ///
  2416.  
  2417. //New object code starts HERE (2015 yahhh!!!)
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425. ///Try to call draw zingers from here yep
  2426. //Handle beatles after this, make sure to pass mode$ to it
  2427.  
  2428. //Handle Krooks after this (collision)
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436. if menu=2
  2437. drawimage barrel_(1), 564, 0, 1
  2438. drawimage barrel_(2), 628, 0, 1
  2439. drawimage barrel_(3), 564, 64, 1
  2440. drawimage barrel_(4), 628, 64, 1
  2441. drawimage obj_hook, 628+64, 96, 1
  2442.  
  2443.  
  2444. if mouseinbox(564, 0, 628, 64)
  2445. if leftmousebutton()
  2446. barrel_selected=1
  2447. obj_selected=1
  2448. endif
  2449. endif
  2450.  
  2451. if mouseinbox(628, 0, 692, 64)
  2452. if leftmousebutton()
  2453. barrel_selected=2
  2454. obj_selected=1
  2455. endif
  2456. endif
  2457.  
  2458. if mouseinbox(564, 64, 628, 128)
  2459. if leftmousebutton()
  2460. barrel_selected=3
  2461. obj_selected=1
  2462. endif
  2463. endif
  2464.  
  2465. if mouseinbox(628, 64, 692, 128)
  2466. if leftmousebutton()
  2467. barrel_selected=4
  2468. obj_selected=1
  2469. endif
  2470. endif
  2471.  
  2472. if mouseinbox(628+64, 64, 628+64+16, 628+64+31)
  2473. if leftmousebutton()
  2474. obj_selected=2
  2475. endif
  2476. endif
  2477.  
  2478.  
  2479.  
  2480. //The testbarrel is here
  2481. if leftmousebutton()
  2482. testing_barrel_x=mousex()+scrollx
  2483. testing_barrel_y=mousey()+scrolly
  2484. rambix=mousex()+scrollx
  2485. rambiy=mousey()+scrolly
  2486. //SquitterCrateX=mousex()+scrollx
  2487. //SquitterCrateY=mousey()+scrolly
  2488.  
  2489.  
  2490. endif
  2491.  
  2492. if obj_selected=1
  2493. if barrel_selected<1 then barrel_selected=1
  2494. drawimage barrel_(barrel_selected), testing_barrel_x-scrollx, testing_barrel_y-scrolly, 1
  2495.  
  2496.  
  2497. if rightmousebutton()
  2498. b_barrels(current_blast_barrel).x1=testing_barrel_x
  2499. b_barrels(current_blast_barrel).y1=testing_barrel_y
  2500. b_barrels(current_blast_barrel).x2=testing_barrel_x+64
  2501. b_barrels(current_blast_barrel).y2=testing_barrel_y+64
  2502. b_barrels(current_blast_barrel).facing_type=barrel_selected
  2503. menu=1
  2504. current_blast_barrel=current_blast_barrel+1
  2505. endif
  2506.  
  2507.  
  2508. endif
  2509. endif
  2510.  
  2511.  
  2512. if obj_selected=2
  2513. drawimage obj_hook, testing_barrel_x-scrollx, testing_barrel_y-scrolly, 1
  2514.  
  2515. if rightmousebutton()
  2516. hooks(current_hook).x1=testing_barrel_x
  2517. hooks(current_hook).y1=testing_barrel_y
  2518. hooks(current_hook).x2=testing_barrel_x+16
  2519. hooks(current_hook).y2=testing_barrel_y+31
  2520. current_hook=current_hook+1
  2521. if current_hook=>30 then current_hook=30
  2522. endif
  2523. endif
  2524.  
  2525.  
  2526.  
  2527. for temp=1 to 30
  2528. checkingx1=b_barrels(temp).x1
  2529. checkingy1=b_barrels(temp).y1
  2530. checkingx2=b_barrels(temp).x2
  2531. checkingy2=b_barrels(temp).y2
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537. facing=b_barrels(temp).facing_type
  2538. drawimage barrel_(facing), checkingx1-scrollx, checkingy1-scrolly, 1
  2539. box checkingx1-scrollx, checkingy1-scrolly, checkingx2-scrollx, checkingy2-scrolly, 0
  2540.  
  2541.  
  2542. playerx1=charx
  2543. playery1=chary
  2544. playerx2=charx+spritewidth
  2545. playery2=chary+spriteheight
  2546.  
  2547. ;if playerx2>checkingx1-3
  2548. ; if playerx2<checkingx2
  2549. ;if playery2>checkingy1
  2550. ;if playery1<checkingy2
  2551. ;dixieblasted=true
  2552. ;dixieblasteddirection=b_barrels(temp).facing_type
  2553. ;dixieblastedspeed=5
  2554. ; endif
  2555. ;endif
  2556. ; endif
  2557. ; endif
  2558.  
  2559. ;check right collision
  2560. ;if playerx1>checkingx2-3
  2561. ;if playerx1<checkingx2+3
  2562. ;if playery2>checkingy1
  2563. ;if playery1<checkingy2
  2564. ;dixieblasted=true
  2565. ;dixieblasteddirection=b_barrels(temp).facing_type
  2566. ;dixieblastedspeed=5
  2567. ;endif
  2568. ;endif
  2569. ;endif
  2570. ;endif
  2571.  
  2572.  
  2573.  
  2574. if playerx2=>checkingx1
  2575. if playerx1<=checkingx2
  2576. if playery2=>checkingy1
  2577. if playery1<=checkingy2
  2578. dixieblasted=true
  2579. dixieblasteddirection=b_barrels(temp).facing_type
  2580. dixieblastedspeed=50
  2581. playsound blastbarrel
  2582. endif
  2583. endif
  2584. endif
  2585. endif
  2586.  
  2587.  
  2588.  
  2589.  
  2590. next temp
  2591.  
  2592. for temp=1 to 30
  2593.  
  2594. checkingx1=hooks(temp).x1
  2595. checkingy1=hooks(temp).y1
  2596. checkingx2=hooks(temp).x2
  2597. checkingy2=hooks(temp).y2
  2598.  
  2599. drawimage obj_hook, checkingx1-scrollx, checkingy1-scrolly, 1
  2600.  
  2601. next temp
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607. if dixieblasted=true
  2608. s=dixieblastedspeed
  2609. select dixieblasteddirection
  2610. case 1
  2611. chary=chary-s
  2612. scrollimage backdrop, 0, s/2
  2613. scrollimage sky, 0, s/4
  2614. scrolly=scrolly-s
  2615. case 2
  2616. chary=chary+s
  2617. scrolly=scrolly+s
  2618. scrollimage backdrop, 0, -s/2
  2619. scrollimage sky, 0, -s/4
  2620. case 3
  2621. charx=charx-s
  2622. scrollx=scrollx-s
  2623. scrollimage backdrop, s/2, 0
  2624. scrollimage sky, s/4, 0
  2625. case 4
  2626. charx=charx+s
  2627. scrollx=scrollx+s
  2628. scrollimage backdrop, -s/2, 0
  2629. scrollimage sky, -s/4, 0
  2630. endselect
  2631.  
  2632. dixieblastedspeed=dixieblastedspeed-1
  2633.  
  2634. if dixieblastedspeed<=0
  2635. dixieblasted=false
  2636. endif
  2637.  
  2638.  
  2639.  
  2640. endif
  2641.  
  2642.  
  2643.  
  2644.  
  2645. ;manage camera
  2646.  
  2647. ;only in playmode
  2648. if mode$="playmode"
  2649.  
  2650.  
  2651. if scrollx+640-charx>320 ;left side
  2652. scrollx=scrollx-8
  2653. endif
  2654.  
  2655. if scrolly+480-chary>240 ;top side
  2656. scrolly=scrolly-4
  2657. endif
  2658.  
  2659.  
  2660. if chary-scrolly>240 ;Bottom Side
  2661. scrolly=scrolly+4
  2662. endif
  2663.  
  2664. if charx-scrollx>320 ;Right Side
  2665. scrollx=scrollx+8
  2666. endif
  2667.  
  2668.  
  2669. ;patch in barrel placing
  2670.  
  2671. if rightmousebutton()
  2672. //barrels(1).x1=mousex()+scrollx
  2673. //barrels(1).y1=mousey()+scrolly
  2674. //barrels(1).x2=barrels(1).x1+barrelwidth
  2675. // barrels(1).y2=barrels(1).y1+barrelheight
  2676.  
  2677. //Use this for the crate instead
  2678.  
  2679. SquitterCrateX=mousex()+scrollx
  2680. SquitterCrateY=mousey()+scrolly
  2681. gameobjects(1).X=mousex()+scrollx
  2682. gameobjects(1).y=mousey()+scrolly
  2683.  
  2684.  
  2685.  
  2686.  
  2687. if spacekey()
  2688. barrels(1).falling=true
  2689. endif
  2690.  
  2691.  
  2692.  
  2693. endif
  2694.  
  2695.  
  2696.  
  2697.  
  2698. endif
  2699.  
  2700.  
  2701.  
  2702. if keystate(181)
  2703. mode$="tile_mode"
  2704. endif
  2705.  
  2706.  
  2707. for temp=1 to 250
  2708.  
  2709. //Get object type
  2710. THISTYPE=GAMEOBJECTS(temp).obj_type
  2711.  
  2712. select THISTYPE
  2713.  
  2714. case 1
  2715.  
  2716.  
  2717. handlebanana(bananatimer, pushframes, charx, chary, spritewidth, spriteheight, temp, scrollx, scrolly, bananacollect)
  2718.  
  2719. case 3 //IF CASE THREE THEN GET THE FUCK OUT!!!
  2720.  
  2721.  
  2722. //dim zing as object
  2723. //zing.object=gameobjects(temp).object
  2724. handlezinger(gameobjects().object, temp)
  2725.  
  2726.  
  2727. ///GRR WHY WONT IT CALL IT!!?!?!?!
  2728. //gameobjects(temp).frame=gameobjects(temp).frame+1 //FORCE the frame update skip it in the subroutine fuck it
  2729.  
  2730. drawzinger(temp, scrollx, scrolly, gameobjects().object)
  2731.  
  2732. case 4
  2733.  
  2734. case 5
  2735.  
  2736. handleballoon(pushframes, charx, chary, spritewidth, spriteheight, temp, scrollx, scrolly, gameobjects().object, ballooncollect)
  2737.  
  2738.  
  2739. ENDSELECT
  2740.  
  2741. //iF THISTYPE=3 THEN handlezinger(temp)
  2742. //IF THISTYPE=3 THEN DRAWZINGER(temp, scrollx, scrolly)
  2743.  
  2744.  
  2745.  
  2746. //if temp<50
  2747. //if THISTYPE<>1
  2748. //#print THISTYPE
  2749. // GAMEOBJECTS(temp).obj_type=1
  2750. // endif
  2751.  
  2752. //endif
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762. next temp
  2763.  
  2764. //This belongs here not up there god damnit
  2765.  
  2766. pushframes=false
  2767.  
  2768.  
  2769. sync
  2770. cls rgb(0,0,0)
  2771. loop
  2772.  
  2773. //Handle a SINGLE Beatle Collision
  2774. function beatle_collision(object_number, MAPWIDTH, MAPHEIGHT)
  2775.  
  2776.  
  2777. x1=GameObjects(object_number).x1
  2778. y1=GameObjects(object_number).y1
  2779. x2=x1+48
  2780. y2=y1+32
  2781. ;landed=beatles(temp).landed ;today I found this glitch. The players collision check WAS registering. But this bugger was changing it to whatever the value of the last beatle checked is. BUGGER!
  2782.  
  2783. falling=GameObjects(object_number).falling
  2784. ftimer=GameObjects(object_number).frametimer
  2785. facing=GameObjects(object_number).facing
  2786.  
  2787. if timer()>ftimer
  2788.  
  2789. GameObjects(object_number).frame=GameObjects(object_number).frame+1
  2790. GameObjects(object_number).frametimer=timer()+30
  2791. endif
  2792.  
  2793. if GameObjects(object_number).frame>8 then GameObjects(object_number).frame=1
  2794.  
  2795. amountx=x1
  2796. amounty=y1
  2797. amountx=roundup(amountx/16) ;get the tile number of x
  2798. amounty=roundup(amounty/16) ;get the tile number of y
  2799.  
  2800. for tempx=amountx-2 to amountx+2
  2801. for tempy=amounty-2 to amounty+2
  2802.  
  2803. checkingx=tempx
  2804. checkingy=tempy
  2805. if checkingx>MAPWIDTH then checkingx=MAPWIDTH
  2806. if checkingy>MAPHEIGHT then checkingy=MAPHEIGHT
  2807.  
  2808. if checkingx<1 then checkingx=1
  2809. if checkingy<1 then checkingy=1
  2810.  
  2811. if map(checkingx, checkingy)=1 ;if the tile is solid, check against beatle collision
  2812.  
  2813.  
  2814. checkingx1=solids(checkingx, checkingy).x1
  2815. checkingy1=solids(checkingx, checkingy).y1
  2816. checkingx2=solids(checkingx, checkingy).x2
  2817. checkingy2=solids(checkingx, checkingy).y2
  2818.  
  2819. cpseed=3
  2820.  
  2821.  
  2822.  
  2823.  
  2824. if x2>checkingx1
  2825. if x1<checkingx2
  2826. if y1<checkingy1
  2827. if y2>checkingy1-cspeed
  2828. GameObjects(object_number).landed=true
  2829. GameObjects(object_number).falling=false
  2830. endif
  2831. endif
  2832. endif
  2833. endif
  2834. endif
  2835.  
  2836. next tempy
  2837. next tempx
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843. endfunction
  2844.  
  2845.  
  2846. function draw_blank_tiles()
  2847. for tempx=amountx to 20+amountx+1
  2848. for tempy=amounty to 15+amounty+1
  2849.  
  2850. x=(tempx-1)*32
  2851. y=(tempy-1)*32
  2852.  
  2853. xdraw=x-SCROLLX
  2854. ydraw=y-SCROLLY
  2855.  
  2856.  
  2857.  
  2858.  
  2859. ;tilenum=map(tempx, tempy)
  2860. ;print "Tilenum is" +str$(tilenum)
  2861. ;print "Press key to show image"
  2862. ;waitkey
  2863. ;waitnokey
  2864. ;sync
  2865.  
  2866. if tilenum=<0 then tilenum=1
  2867. if tilenum=>101 then tilenum=100
  2868.  
  2869. drawimage tiles(tilenum), xdraw, ydraw, 0
  2870.  
  2871. next tempy
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877. next tempx
  2878. rendertoscreen
  2879. drawimage timage, 0, 0, 0
  2880. endfunction
  2881.  
  2882. function pushbananaframe(number)
  2883.  
  2884. GameObjects(number).frame=GameObjects(number).frame+1
  2885. if GameObjects(number).frame>8 then GameObjects(number).frame=1
  2886.  
  2887. endfunction
  2888.  
  2889.  
  2890. //Call this from main loop when handling the object
  2891. function handlezinger(gameobjects().object, index)
  2892. //Gnum=object_number
  2893.  
  2894.  
  2895. //#print "This code was reached"
  2896.  
  2897.  
  2898.  
  2899. x1=gameobjects(index).x1
  2900. y1=gameobjects(index).y1
  2901. frame=gameobjects(index).frame
  2902. ftimer=gameobjects(index).frametimer
  2903. directionleft=gameobjects(index).directionleft
  2904. facing=gameobjects(index).facing
  2905.  
  2906.  
  2907.  
  2908.  
  2909. //gameob
  2910. gameobjects(index).frame=gameobjects(index).frame+1
  2911. if gameobjects(index).frame>3 then gameobjects(index).frame=1 //THERE!!
  2912.  
  2913. //#print "Difference between frame timer and current timer is " + str$(ftimer-timer() )
  2914. //#print "The frame for this bee is at " +str$(frame)
  2915.  
  2916. //if spacekey()
  2917. //GameObjects(gnum).frametimer=timer()+30
  2918. //endif
  2919.  
  2920.  
  2921.  
  2922. if timer()>ftimer
  2923.  
  2924. GameObjects(index).frame=GameObjects(index).frame+1
  2925. GameObjects(index).frametimer=timer()+30
  2926.  
  2927.  
  2928. gameobjects(index).directionleft=gameobjects(index).directionleft-1
  2929.  
  2930. endif
  2931.  
  2932. ///Why is this getting messed up? I don't know let's fix it... fuck sakes...
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941. select facing
  2942.  
  2943. #print "Local object reads as " +str$(facing)
  2944. #print "Actual facing value is " +str$(gameobjects(index).facing)
  2945.  
  2946. case 1
  2947. gameobjects(index).x1=gameobjects(index).x1-3
  2948. //#print "This code was tested"
  2949.  
  2950. if directionleft<=0
  2951. gameobjects(index).facing=2
  2952. gameobjects(index).directionleft=30
  2953. endif
  2954.  
  2955.  
  2956. case 2
  2957. gameobjects(index).x1=gameobjects(index).x1+3
  2958.  
  2959. if directionleft<=0
  2960. gameobjects(index).facing=1
  2961. gameobjects(index).directionleft=30
  2962. endif
  2963.  
  2964. case 0
  2965. facing=1
  2966.  
  2967. endselect
  2968.  
  2969.  
  2970. if gameobjects(index).frame>3 then gameobjects(index).frame=1
  2971.  
  2972.  
  2973.  
  2974. endfunction zinger
  2975.  
  2976. //This handles ONE zinger. It's a draw function. See handlezinger for dealing with the sprites!
  2977. function drawzinger(index, scrollx, scrolly, gameobjects().object)
  2978.  
  2979.  
  2980.  
  2981.  
  2982. //THE DAMN STUPID GAME ENGINE SHOULD BE ABLE TO GET THIS
  2983. frame=gameobjects(index).frame
  2984.  
  2985. ///HOW ABOUT AGAIN!?!
  2986.  
  2987.  
  2988. //#print THISFRAME
  2989. facing=gameobjects(index).facing
  2990. select facing
  2991. case 1
  2992. drawimage zingerfacesleft(frame), gameobjects(index).x1-scrollx, gameobjects(index).y1-scrolly, 1
  2993. case 2
  2994. drawimage zingerfacesright(frame), gameobjects(index).x1-scrollx, gameobjects(index).y1-scrolly, 1
  2995. endselect
  2996.  
  2997.  
  2998. endfunction
  2999.  
  3000. //This handles ONE beatle, pass object number and mode$ to it k thx
  3001.  
  3002. function handlebeatle(object_number, mode$, scrollx, scrolly)
  3003.  
  3004.  
  3005.  
  3006. frame=GameObjects(object_number).frame
  3007.  
  3008.  
  3009.  
  3010.  
  3011. facing=GameObjects(object_number).facing
  3012. blanded=GameObjects(object_number).landed
  3013. bfalling=GameObjects(object_number).falling
  3014.  
  3015. if blanded=false
  3016. if bfalling=true
  3017. if mode$="playmode"
  3018. GameObjects(object_number).y1=GameObjects(object_number).y1+3
  3019. endif
  3020. endif
  3021. endif
  3022.  
  3023.  
  3024. select facing
  3025. case 1
  3026. if blanded=true
  3027. GameObjects(object_number).x1=GameObjects(object_number).x1-2
  3028. endif
  3029. drawimage beatlefacesleft(frame), GameObjects(object_number).x1-scrollx, GameObjects(object_number).y1-scrolly, 1
  3030. case 2
  3031. if blanded=true
  3032. GameObjects(object_number).x1=GameObjects(object_number).x1+2
  3033. endif
  3034. drawimage beatlefacesright(frame), GameObjects(object_number).x1-scrollx, GameObjects(object_number).y1-scrolly, 1
  3035. endselect
  3036.  
  3037. GameObjects(object_number).falling=true
  3038. GameObjects(object_number).landed=false
  3039.  
  3040.  
  3041. endfunction
  3042.  
  3043. function handlebanana(bananatimer, pushframes, charx, chary, spritewidth, spriteheight, object_number, scrollx, scrolly, bananacollect)
  3044.  
  3045.  
  3046.  
  3047.  
  3048. number=object_number
  3049. xx=scrollx
  3050. yy=scrolly
  3051. frame=GameObjects(number).frame
  3052. if frame>8 then frame=8
  3053. if frame<1 then frame=1
  3054. x=GameObjects(number).x
  3055. y=GameObjects(number).y
  3056. collected=GameObjects(number).collected
  3057. if collected=false
  3058. drawimage bananaframes(frame), x-xx, y-yy, 1
  3059. if pushframes=true
  3060. pushbananaframe(number)
  3061. endif
  3062. endif
  3063.  
  3064.  
  3065. if charx+spritewidth=>x
  3066. if chary+spriteheight=>y
  3067. if charx<x+16
  3068. if chary<y+16
  3069. if GameObjects(numer).collected=false
  3070. playsound bananacollect
  3071. endif
  3072. GameObjects(number).collected=true
  3073. endif
  3074. endif
  3075. endif
  3076. endif
  3077.  
  3078.  
  3079.  
  3080.  
  3081. endfunction
  3082.  
  3083.  
  3084. function handleballoon(pushframes, charx, chary, spritewidth, spriteheight, object_number, scrollx, scrolly, gameobjects().object, ballooncollect)
  3085.  
  3086.  
  3087.  
  3088.  
  3089. number=object_number
  3090. xx=scrollx
  3091. yy=scrolly
  3092. frame=GameObjects(number).frame
  3093. if frame>5 then frame=5
  3094. if frame<1 then frame=1
  3095. x=GameObjects(number).x
  3096. y=GameObjects(number).y
  3097. collected=GameObjects(number).collected
  3098. if collected=false
  3099. drawimage balloon(frame), x-xx, y-yy, 1
  3100.  
  3101. //We'll borrow the banana's frame timer for now it might be smoother
  3102. if pushframes=true
  3103. pushbananaframe(number)
  3104. endif
  3105. endif
  3106.  
  3107.  
  3108. if charx+spritewidth=>x
  3109. if chary+spriteheight=>y
  3110. if charx<x+16
  3111. if chary<y+16
  3112.  
  3113. if Gameobjects(number).collected=false
  3114. playsound ballooncollect
  3115. endif //The sound should only play once!
  3116. GameObjects(number).collected=true
  3117.  
  3118. endif
  3119. endif
  3120. endif
  3121. endif
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128. endfunction
  3129.  
  3130.  
  3131. //Handle a SINGLE Krook
  3132. function handle_krooks(object_number, scrollx, scrolly)
  3133.  
  3134.  
  3135. //Handle a SINGLE Krook collision
  3136.  
  3137.  
  3138.  
  3139.  
  3140. frame=GameObjects(object_number).frame
  3141. facing=GameObjects(object_number).facing
  3142. klanded=GameObjects(object_number).landed
  3143. kfalling=GameObjects(object_number).falling
  3144.  
  3145. if klanded=false
  3146. if kfalling=true
  3147. if mode$="playmode"
  3148. GameObjects(object_number).y1=GameObjects(object_number).y1+3
  3149. endif
  3150. endif
  3151. endif
  3152.  
  3153.  
  3154. select facing
  3155. case 1
  3156. if klanded=true
  3157. GameObjects(object_number).x1=GameObjects(object_number).x1-2
  3158. endif
  3159. drawimage krook_walk_left(frame), GameObjects(object_number).x1-scrollx, GameObjects(object_number).y1-scrolly, 1
  3160. case 2
  3161. if klanded=true
  3162. GameObjects(object_number).x1=GameObjects(object_number).x1+2
  3163. endif
  3164. drawimage krook_walk_right(frame), GameObjects(object_number).x1-scrollx, GameObjects(object_number).y1-scrolly, 1
  3165. endselect
  3166.  
  3167. GameObjects(object_number).falling=true
  3168. GameObjects(object_number).landed=false
  3169.  
  3170. x2=GameObjects(object_number).x1+95
  3171. y2=GameObjects(object_number).y1+56
  3172.  
  3173. ink rgb(255, 255, 255)
  3174. box GameObjects(object_number).x1-scrollx, GameObjects(object_number).y1-scrolly, x2-scrollx, y2-scrolly, 0
  3175.  
  3176.  
  3177. endfunction
  3178.  
  3179. //Handle a SINGLE Krook Collision!!
  3180. function krook_collision(object_number)
  3181.  
  3182. x1=GameObjects(object_number).x1
  3183. y1=GameObjects(object_number).y1
  3184. x2=x1+95
  3185. y2=y1+56
  3186. ;landed=beatles(temp).landed ;today I found this glitch. The players collision check WAS registering. But this bugger was changing it to whatever the value of the last beatle checked is. BUGGER!
  3187.  
  3188. falling=GameObjects(object_number).falling
  3189. ftimer=GameObjects(object_number).frametimer
  3190. facing=GameObjects(object_number).facing
  3191.  
  3192. if timer()>ftimer
  3193.  
  3194. GameObjects(object_number).frame=GameObjects(object_number).frame+1
  3195. GameObjects(object_number).frametimer=timer()+5
  3196. endif
  3197.  
  3198. if GameObjects(object_number).frame>11 then GameObjects(object_number).frame=1
  3199.  
  3200. amountx=x1
  3201. amounty=y1
  3202. amountx=roundup(amountx/16) ;get the tile number of x
  3203. amounty=roundup(amounty/16) ;get the tile number of y
  3204.  
  3205. for tempx=amountx-4 to amountx+4 //NOTE for larger enemies or hitboxes this range will need to be larger
  3206. for tempy=amounty-4 to amounty+4 //NOTE for larger enemies or hitboxes this range will need to be larger
  3207.  
  3208. checkingx=tempx
  3209. checkingy=tempy
  3210. if checkingx>MAPWIDTH then checkingx=MAPWIDTH
  3211. if checkingy>MAPHEIGHT then checkingy=MAPHEIGHT
  3212.  
  3213. if checkingx<1 then checkingx=1
  3214. if checkingy<1 then checkingy=1
  3215.  
  3216. if map(checkingx, checkingy)=1 ;if the tile is solid, check against beatle collision
  3217.  
  3218.  
  3219. checkingx1=solids(checkingx, checkingy).x1
  3220. checkingy1=solids(checkingx, checkingy).y1
  3221. checkingx2=solids(checkingx, checkingy).x2
  3222. checkingy2=solids(checkingx, checkingy).y2
  3223.  
  3224. cpseed=3
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232. if x2>checkingx1
  3233. if x1<checkingx2
  3234. if y1<checkingy1
  3235. if y2>(checkingy1)-cspeed
  3236. GameObjects(object_number).landed=true
  3237. GameObjects(object_number).falling=false
  3238. endif
  3239. endif
  3240. endif
  3241. endif
  3242. endif
  3243.  
  3244. next tempy
  3245. next tempx
  3246.  
  3247.  
  3248.  
  3249. endfunction
  3250.  
  3251.  
  3252. /// these are loops and functions for testing only. PASTE ABOVE LOADING TO TEST::
  3253.  
  3254. frametimer=timer()+10
  3255. dkcoinframe=1
  3256. littleloop:
  3257.  
  3258. if dkcoinframe>11
  3259. dkcoinframe=1
  3260. endif
  3261.  
  3262. drawimage krook_walk_right(dkcoinframe), 100, 100, 1
  3263.  
  3264.  
  3265. if timer()>frametimer
  3266. dkcoinframe=dkcoinframe+1
  3267. frametimer=timer()+100
  3268.  
  3269. endif
  3270.  
  3271. text 100, 110, "currentframe = "+str$(dkcoinframe)
  3272.  
  3273.  
  3274. function showfacing(object)
  3275.  
  3276. print "The direction for this bee is "
  3277.  
  3278.  
  3279. waitkey
  3280. waitnokey
  3281.  
  3282.  
  3283.  
  3284. endfunction
  3285.  
  3286.  
  3287. sync
  3288. cls rgb(0,0,0)
  3289.  
  3290. goto littleloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement