From 33c990ab34421980b9d44dbbceeb71bb8a6512d7 Mon Sep 17 00:00:00 2001 From: MikeDX Date: Fri, 17 Jun 2016 03:28:44 +0100 Subject: [PATCH] removed dupe files --- examples/games/malvado/Malvado.prg | 1862 ---------------------------- examples/games/pacoman/Pacoman.prg | 870 ------------- examples/games/pool/Pool.prg | 754 ----------- examples/games/speed/Speed.prg | 1137 ----------------- 4 files changed, 4623 deletions(-) delete mode 100644 examples/games/malvado/Malvado.prg delete mode 100644 examples/games/pacoman/Pacoman.prg delete mode 100644 examples/games/pool/Pool.prg delete mode 100644 examples/games/speed/Speed.prg diff --git a/examples/games/malvado/Malvado.prg b/examples/games/malvado/Malvado.prg deleted file mode 100644 index 9139e60..0000000 --- a/examples/games/malvado/Malvado.prg +++ /dev/null @@ -1,1862 +0,0 @@ -compiler_options _extended_conditions; - - -//----------------------------------------------------------------------------- -// TITLE: CASTLE OF DR MALVADO -// AUTHOR: DANIEL NAVARRO -// DATE: DIV GAMES STUDIO (c) 2000 -//----------------------------------------------------------------------------- - -PROGRAM castle_of_dr_malvado; - -GLOBAL - level=1; // Number of levels - lifes=10; // Number of lifes - score=0; // Score's variable - bonus=0; // Number of collected bonus - font1,font2; // Fonts' identifiers - - s_fish; // Identifier for fishes' sound - s_touch; // Identifier for touches' sound - s_star; // Identifier for stars' sound - s_spider; // Identifier for spiders' sound - s_bear; // Identifier for bears' sound - s_bee; // Identifier for bees' sound - s_ghost; // Identifier for ghosts' sound - s_jump1; // Identifier for jump1's sound - s_jump2; // Identifier for jump2's sound - s_fall; // Identifier for falling' sound - s_bubble; // Identifier for bubbles' sound - s_bonus; // Identifier for collecting bonus' sound - s_malvado; // Identifier for Dr.Malvado's death - - energy_enemy; // Final bosses enemies' energy level variable - id_enemy_bar; // Identifier to quit energy bar - level_end=false; // Variable to control when a level has been finished - idlifetext; // Variables that handle text when a life appears - countlifetext; - withlifetext=0; - mainid; -LOCAL - gravity_speed; // Variable for storing falling speed (gravity) - speed=0; // Variable for storing horizontal character's speed - death; // Variable for storing if the character is dead - angle2; // Variable for general angles - -PRIVATE - _screen=1; // Screen that is seen as menu - _quit=0; // 1= Quit game -BEGIN - - mainid=id; - set_fps(24,4); // Sets screen frame rate to 24 frames per second - // With a maximum error of 4 screens jumps - // Loads the general graphics file - load_fpg("malvado\malvado.fpg"); - - // Loads font types files - font1=load_fnt("malvado\number.fnt"); - font2=load_fnt("malvado\letters.fnt"); - - // Loads game sounds - s_fish=load_pcm("malvado\fish.pcm",0); - s_touch=load_pcm("malvado\hit.pcm",0); - s_star=load_pcm("malvado\star.pcm",0); - s_spider=load_pcm("malvado\spider.pcm",0); - s_bear=load_pcm("malvado\bear.pcm",0); - s_bee=load_pcm("malvado\bee.pcm",0); - s_ghost=load_pcm("malvado\ghost.pcm",0); - s_jump1=load_pcm("malvado\jump1.pcm",0); - s_jump2=load_pcm("malvado\jump2.pcm",0); - s_fall=load_pcm("malvado\fall.pcm",0); - s_bubble=load_pcm("malvado\bubble.pcm",0); - s_bonus=load_pcm("malvado\bonus.pcm",0); - s_malvado=load_pcm("malvado\malvado.pcm",0); - - LOOP // Main loop - timer=1000; // Initializes out of time, so it is changed when just entered - _screen=3; // Selects the other screen, because it changes when just entered - - REPEAT // Presentation screens' loop - IF (timer>500) // After 5 secs, changes screen - timer=0; - IF (_screen==1) - _screen=3; // 3:Credits' screen - ELSE - _screen=1; - END // 1:Menu screen - fade_off(); - put_screen(0,_screen); - fade_on(); - END - angle+=10000; - FRAME; - until (scan_code<>0); - // Waits for a key to be pressed - - // If 'ESC' was pressed, exits game - IF (key(_esc)) - fade_off(); - exit("Thanks for playing!",0); - END - - fade_off(); // Fades screen off - // Initializes game's variables - // Level=1, lifes=3, score=0, bonus=0 - level=1; - lifes=3; - score=0; - bonus=0; - - REPEAT // Loop for 'loading...' screen - fade_on(); // Fades screen on - put_screen(0,2);// Puts background screen - write(font2,138,77,4,"LEVEL"); - write_int(font2,208,77,4,&level); - WHILE (fading) // Waits while everything is initiated, which - FRAME; // will happen when screen is faded off - END - delete_text(all_text); - // Puts scores, lifes and bonus graphics - object(0,222,16,16,-512,0); // Prints lifes - write(font1,36,16,4,"x"); - write_int(font1,44,16,3,&lifes); - write_int(font1,160,16,4,&score); // Prints score - object(0,216,270,17,-512,0); // Prints bonus - write(font1,288,16,4,"x"); - write_int(font1,296,16,3,&bonus); - level_end=false; // Initializes the variable - // that controls stage/level end - // Puts texts when a level is started - SWITCH (level) // Loop for levels - CASE 1: // Initializes level one - // Loads graphics for level one - load_fpg("malvado\level1.fpg"); - - // Initializes scroll - start_scroll(0,1,1,3,0,4); - // Defines scroll region after which it will move - scroll.region1=define_region(1,96,100,1,1); - - - // Initializes objects that overlap other objects - object(1,20,2080,122,-256,1); // Graphics for door frames - object(1,21,2102,34,-256,1); - object(1,22,3286,72,32,1); // Graphics for overlapping bubbles (cauldron) - - // Initializes first plane objects - first_plane(12,200); // Bushes graphic - first_plane(10,500); // Casttle direction signal - first_plane(11,780); // Grave - first_plane(12,1300); // Bushes - first_plane(13,2150); // Candle - first_plane(13,2800); // Candle - - // Initializes objects for platforms chains - chain(2840,8,0,pi/48,pi/4); - chain(3133,8,pi,pi/32,pi/4); - chain(3660,80,0,pi/24,pi/4); - - // Initializes character's object - jack(8,0); - - // Initializes bears' objects - bear(82,189,-1); - bear(256,274,-2); - bear(484,158,-3); - bear(580,247,-2); - bear(798,189,-3); - bear(1053,191,-3); - bear(1675,100,-4); - bear(2036,175,-6); - - // Initializes bees' objects - flying(310,0,600,140,110,64,100,64); - flying(310,0,900,140,110,64,160,100); - flying(310,0,1300,170,90,48,200,50); - flying(310,0,1320,150,95,60,150,75); - flying(310,0,1820,100,48,36,64,64); - - // Initializes ghosts' objects - flying(320,4,2170,100,48,36,64,64); - flying(320,4,2329,224,100,24,220,32); - flying(320,4,2865,100,48,36,96,96); - flying(320,4,3100,64,100,36,96,96); - - // Initializes spiders' objects - spider(2349,63,65); - spider(2218,152,78); - spider(2534,0,77); - - // Initializes fire objects - fire(2280,256,10); - fire(2390,256,11); - - // Takes control points from bonus map - FROM z=0 TO 25; - get_point(1,1,z,&x,&y); // Takes control point - p_bonus(x,y); // Puts bonus - END - END - - CASE 2: // Initializes level two - // Loadsd level two's graphics file - load_fpg("malvado\level2.fpg"); - - // Initializes scroll for level 2 - start_scroll(0,1,1,3,0,4); - // Selects scroll region after which it moves - scroll.region1=define_region(1,160,150,1,1); - - // Initializes metallic platforms met licas that are set diagonally - metal_platform(214,1590,128,1443,2); - metal_platform(108,1249,212,1249,1); - metal_platform(212,1193,212,1056-58,2); - metal_platform(108,1193,108,1056+64,1); - metal_platform(158,582,158,624,5); - - // Initializes spikes ball - spikes_ball(157,1121); - chain(160,532,0,pi/24,pi/10); // Initializes chain - - // Initializescharacter - jack(8,1971); - - // Initializes pumpkins - pumpkin(100,1855,2); - pumpkin(100,1583,2); - pumpkin(233,1311,1); - pumpkin(219,313,2); - pumpkin(208,189,3); - - // Initializes spitting heads - head(264,1894,1,24); - head(264,1515,1,96); - head(264,465,1,26); - head(56,1515,0,96); - head(56,1298,0,26); - head(264,792,1,26); - head(56,174,0,24); - - // Initializes spiders - spider(74,1612,100); - spider(245,955,274); - spider(75,285,83); - spider(245,23,71); - - // Initializes ghosts - flying(320,4,158,1760,90,70,80,80); - flying(320,4,158,1145,140,110,80,80); - flying(320,4,158,616,48,64,80,120); - flying(320,4,158,190,64,96,90,110); - - // Takes control points for bonus - FROM z=0 TO 25; - get_point(1,1,z,&x,&y); // Takes control point - p_bonus(x,y); // Puts bonus - END - END - - CASE 3: // Initializes level three - // Loads level three's graphics file - load_fpg("malvado\level3.fpg"); - - // Initializes scroll for level 3 - start_scroll(0,1,1,3,0,4); - // Defines scroll region after which it will move - scroll.region1=define_region(1,160,100,1,1); - - // Initializes character - jack(64,0); - - // Initializa final boss monster (doctor malvado) - malvado(); // Monster object - energy_enemy=16; // Amount of energy - // Necessary identifier, just in case you pass with cheats - id_enemy_bar=energy_bar(); // Initializes energy bar - END - - END - - fade_off(); // Fades screen off - clear_screen(); // Erases screen - fade_on(); // Fades screen on - - REPEAT // Main game loop - IF (level==1) - // Creates decorative fishes and bubbles - SWITCH (rand(0,24)) - CASE 0: fish(rand(380,700),292); END - CASE 1: fish(rand(1290,1354),288); END - CASE 2: fish(rand(1848,1948),250); END - CASE 3,4: bubble(rand(3270,3300),70); END - END - END - // If all the keys that conform 'DIV' word - // you will pass of level - IF (key(_d) AND key (_i) AND key(_v)) - level_end=true; - END - FRAME; - // Repeats until you pass the level, or you have no lifes left - UNTIL (level_end OR lifes<0 OR key (_esc)) - IF (key(_esc)) - _quit=1; - END - IF (level_end) // If the level has been finished - level++; // Increments level - level_end=false; // Initializes level control variable - END - IF (lifes<0) - write(font2,160,100,4,"GAME OVER"); - END - IF (level==4) - write(font2,160,100,4,"WELL DONE"); - END - - FRAME(2400); // Waits a sec - fade_off(); // Fades screen off - stop_scroll(0); // Stops scroll - // Ends all object process that overlap graphics - signal(TYPE object,s_kill); - // Ends first plane object process - signal(TYPE first_plane,s_kill); - // Stops all sounds - stop_sound(all_sound); - // Erases all texts - delete_text(all_text); - // Unloads graphics file - unload_fpg(1); - // Quits final boss' energy bar - signal(id_enemy_bar,s_kill); - // Repeats until you have no more lifes left, or you reach level 4 - UNTIL (lifes<0 OR level==4 OR key (_esc) OR _quit) - _quit=0; - END -END - -//----------------------------------------------------------------------------- -// Process for main character -// Entries: horizontal and vertical coordinates -//----------------------------------------------------------------------------- - -PROCESS jack(x,y); - -PRIVATE - incx=0; // Variable for wall checking - last_y=0; // Variable used to see if he goes up - last_speed=0; // Variable for wall checking - id2; // General purpouse identifier - -BEGIN - ctype=c_scroll; // Puts within scroll - scroll.camera=id; // Makes camera follow him - graph=100; - priority=1; - - LOOP - // Reads keyboard and joystick - IF ((key(_right) OR joy.right) AND speed<8) - speed+=2; // Increases speed to the right - flags=0; // Looks to the right - ELSE - IF ((key(_left) OR joy.left) AND speed>-8) - speed-=2; // Increases speed to the left - flags=1; // Looks to the left - ELSE // If no key is pressed - IF (speed>0) // Brakes to the right - speed--; - END - IF (speed<0) // Or brakes to the left - speed++; - END - END - END - - // Checks if character collides with walls - last_speed=speed; // Saves speed on 'last_speed' - IF (last_speed<>0) // And if he moves - incx=last_speed/abs(last_speed); // Finds the direction - WHILE (last_speed<>0) // 'last_speed' serves as counter - // Checks that it doesn't touches upwards - IF (map_get_pixel(1,2,(x+incx)/2,(y-2)/2)<>120) - // Nor downwards - IF (map_get_pixel(1,2,(x+incx)/2,(y-32)/2)<>120) - x+=incx; // And if so, moves character - END - END - last_speed-=incx; // Subtracts 'last_speed' until it reaches 0 - END - END - - // If he collides with a platform, creates a new character - IF (id2=collision(TYPE platform)) - // He must be going down, and over the platform - IF (gravity_speed>0 AND abs(x-id2.x)<50 AND y<=id2.y+24) - jack_platform(x-id2.x,id2,50,8); - END - END - - // If he collides with a metallic platform, creates a new character - IF (id2=collision(TYPE metal_platform)) - // He must be going down, and over the platform - IF (gravity_speed>0 AND abs(x-id2.x)<36 AND y<=id2.y+12) - jack_platform(x-id2.x,id2,36,-7); - END - END - - gravity(); // Function that calculates character's gravity - - IF (on_screen()) // If character is not going down - IF (speed<>0) // But he moves - graph++; // Changes graphic to animate it - IF (graph>106) - graph=100; - END - ELSE - graph=101; // If he doesn't move, puts default graphic - END - // Reads action keys (Space and Control) or joystick button - IF (key(_space) OR key(_control) OR joy.button1) - sound(s_jump2,100,rand(256,512)); //If pressed plays sound - gravity_speed=-18; // and jumps - END - ELSE // If character goes down - graph=108; // Puts 'going down' graphic - END - - IF (last_y=10) // And if he has over 10 bonuses - bonus-=10; // Subtracts 10 bonus - lifes++; // And adds a life - // Prints an 'EXTRA LIFE' message - idlifetext=write(font1,160,150,4,"EXTRA LIFE"); - countlifetext=0; - withlifetext=1; - END - END - - // Waits 4 secs before erasing message - IF (withlifetext==1) - countlifetext++; - END - IF (countlifetext>99 AND withlifetext==1) - delete_text(idlifetext); - withlifetext=2; - END - // Refreshes zero scroll's internal variables - move_scroll(0); - - IF (level==1) // On level one - IF (y>300) // If he passed the inferior edge - kill_jack(); // Kills Jack - END - IF (x>3400) // If he reached the right edge - // If he hasn't finished the level and the first monster has not been created - IF (not level_end AND not get_id(TYPE malvado_son_head)) - malvado_son(); // Creates final boss monster - energy_enemy=16; // Creates monster's energy bar - id_enemy_bar=energy_bar(); // Saves energy bar's identifier - // to quit it if you are passing with cheats - ELSE // If monster is already created - // Checks for collision with Jack - IF (collision(TYPE malvado_son)) - kill_jack(); // And if he collides, he kills Jack - END - END - END - ELSE - // If you are on level two, and at the end possition - IF (level==2 AND x==58 AND y==53) - level_end=true; // Finishes level - END - END - - last_y=y; // Saves 'y' on last_y to check later if it goes down - FRAME; - END -END - -//------------------------------------------------------------------------------ -// Process for Jack, for when he is over a moving platform -// so he moves at the same time the platform does -// Entries: `relativex` Relative horizontal possition of -// Jack respect the center of the -// platform -// `id2` Platform identifier -// `platform_size` Size (length) of platform -// `incy` Relative vertical possition of -// Jack respect the center of the -// platform -//----------------------------------------------------------------------------- - -PROCESS jack_platform(relativex,id2,platform_size,incy); - -BEGIN - - // Puts to sleep father's process (the one that called him) - // while this process is active - signal(father,s_sleep); - ctype=c_scroll; // Puts whithin scroll - graph=100; // Puts appropiate graphic - flags=father.flags; // Takes father's flags (left/right) - priority=1; // Gives priority 1 so it refreshes - // Jack before scroll - scroll.camera=id; // Makes camara follow Jack - - LOOP - // Reads right key and joystick - IF ((key(_right) OR joy.right) AND speed<8) - speed+=2; // Increments right speed - flags=0; // Puts him facing right - ELSE - IF ((key(_left) OR joy.left) AND speed>-8) - speed-=2; // Increments left speed - flags=1; // Puts him facing left - ELSE // If no direction key has been pressed - IF (speed>0) - speed--; // Brakes to the right - END - IF (speed<0) - speed++; // Brakes to the left - END - END - END - - relativex+=speed; // Adds speed to relative possition - x=relativex+id2.x; // Converts relative possition into real - y=id2.y+incy; - - IF (speed<>0) // If Jack was moving - graph++; // Changes graphic to animate it - IF (graph>106) - graph=100; - END - ELSE - graph=101; // If not, puts graphic for when stopped - END - - // If the jump key is pressed (space or control or joystick) - IF (key(_space) OR key(_control) OR joy.button1) - signal(father,s_wakeup); // Awakes previous process (the father) - father.x=x; // Refreshes coordinate x - father.y=y; // Refreshes coordinate y - father.speed=speed+id2.speed; // Refreshes speed - father.gravity_speed=-18; // Makes Jack jump - father.flags=flags; // Refreshes flags (left/right) - sound(s_jump2,100,rand(256,512)); // Plays jump2 sound - scroll.camera=father; // Forces camera to follow Jack - signal(id,s_kill); // Eliminates current process - FRAME; - END - - // If Jack is out of platform - IF (abs(x-id2.x)>=platform_size+4) - signal(father,s_wakeup); // Awakes previous process - father.x=x; // Refreshes x - father.y=y; // Refreshes y - father.speed=speed+id2.speed; // Refreshes speed - father.flags=flags; // Refreshes flags (left/right) - father.gravity_speed=0; // Leaves Jack floating in the air - scroll.camera=father; // Makes camera follow Jack - signal(id,s_kill); // Eliminates current process - FRAME; - END - - // Checks for collision with bees and ghosts - IF (collision(TYPE flying)) - signal(father,s_kill); // Eliminates previous process - kill_jack(); // Kills Jack - END - - // Checks for collision with first monster - IF (collision(TYPE malvado_son)) - signal(father,s_kill); // Eliminates previous process - kill_jack(); // Kills Jack - END - - // Checks for collision with heads' shots - IF (collision(TYPE head_shot)) - signal(father,s_kill); // Eliminates previous process - kill_jack(); // Kills Jack - END - - // Checks for collision with spikes ball - IF (collision(TYPE ball_end)) - signal(father,s_kill); // Eliminates previous process - kill_jack(); // Kills Jack - END - - // Refreshes internal coordinates of scroll - move_scroll(0); - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process to invoke Jacks dead -//----------------------------------------------------------------------------- - -PROCESS kill_jack() - -PRIVATE - incr_y=-12; // Variable for moving graphic little by lttle - -BEGIN - ctype=c_scroll; // Puts within scroll - graph=116; // Puts adequate graphic - priority=1; // Gives it maximum priority - signal(father,s_sleep); // Puts to sleep father's process (Jack's one) - x=father.x; // Takes Jack's x (father process) - y=father.y; // Takes y - - // If on level one - IF (level==1) - scroll.camera=id; // Makes camera follow Jack - END - y-=12; // Moves character downwards - - REPEAT - y+=incr_y; // Keeps on moving graphic downwards - incr_y++; // Each time slower - angle+=pi/16; // At the same time it rotates - size+=4; // And is 'zoomed' or rescaled - FRAME; - UNTIL (out_region(id,0)); // While it is not out of the screen - // Fades screen off, if there are lifes left - IF (lifes>0) - fade_off(); - ELSE - mainid.x=father.x; - mainid.y=father.y; - scroll.camera=mainid; - END - lifes--; - IF (lifes>-1) // If no lifes left - SWITCH (level) // Depending on level - CASE 1: - - SWITCH(father.x) // And the place he reached on level - CASE 0..799: // creates a new character - jack(8,0); // on the proper possition - END - CASE 800..1959: - jack(800,0); - END - CASE 1960..2531: - jack(1960,0); - END - CASE 2532..3283: - jack(2532,0); - END - DEFAULT: - jack(3284,0); - END - END - END - CASE 2: - SWITCH(father.y) - CASE 0..390: - jack(203,422); - END - CASE 391..950: - jack(68,921); - END - CASE 951..1400: - jack(72,1392); - END - CASE 1401..2000: - jack(8,1971); - END - END - END - END - signal(father,s_kill); // Eliminates previous character - //Fades screen on - fade_on(); - ELSE - signal(TYPE energy_bar,s_kill_tree); // Eliminates final stage bar - END // if needed - -END - -//----------------------------------------------------------------------------- -// Process to invoke special Jack's dead -// when fighting final boss monster that shoots bombs -//----------------------------------------------------------------------------- - -PROCESS kill_jack2(); - -PRIVATE - id2; // Identifier for previous character - incr_y=-12; // Variable for moving graphic down little by little - - -BEGIN - - ctype=c_scroll; // Puts graphic within scroll - graph=116; // Takes 'dead' graphic - id2=get_id(TYPE jack); // Takes character's identifier - signal(id2,s_sleep); // And puts it to sleep - x=id2.x; // Takes Jack's x - y=id2.y-12; // And y, but a little bit down - - REPEAT - y+=incr_y; // Moves graphic downwards - incr_y++; // Each time slower - angle+=pi/16; // Rotates graphic - size+=4; // And rescales it - FRAME; - UNTIL (out_region(id,0)) // Until it gets out of the screen - // Fades screen off if lifes left - IF (lifes>0) - fade_off(); - ELSE - mainid.x=father.x; - mainid.y=father.y; - scroll.camera=mainid; - END - lifes--; // Takes a life off - IF (lifes>-1) // And if you still have lifes left - fade_on(); // Fades screen on - jack(320,0); // Creates a new character - signal(id2,s_kill); // And eliminates previous one - ELSE - signal(TYPE energy_bar,s_kill_tree); // If the game is finished - END // quits final boss' energy bar -END - -//----------------------------------------------------------------------------- -// Process used to calculate floors and character's gravity -//----------------------------------------------------------------------------- - -PROCESS gravity(); - -PRIVATE - vgravity; // Variable for gravity temporary storing - -BEGIN - // Takes coordinate after character's gravity (father) - vgravity=(father.gravity_speed+=2); // But incremented by 2 - IF (vgravity>16) // If higher than 16 - father.gravity_speed=16; // Makes character's gravity equal to 16 - vgravity=16; // And the temporary variable too - END - - IF (vgravity<0) // If gravity is negative - WHILE (vgravity++!=0) // While not zero, increments it - // If not, the ceiling is touched - IF (map_get_pixel(1,2,father.x/2,(father.y-24)/2)<>252) - father.y--; // Makes Jack go up - ELSE // If not, sets gravity to zero - father.gravity_speed=0; - BREAK; - END - END - ELSE // If gravity is zero or positive - father.y+=vgravity; // Jack's coordinates are added - // Checks vertical range of Jack's movement - FROM vgravity=-16 TO 7 STEP 2; // Ends process if floor is touched - IF (map_get_pixel(1,2,father.x/2,(father.y+vgravity)/2)==136) - BREAK; // Exit if floor is touched - END - END - IF (vgravity<8) // If floor is collided - father.y+=vgravity; // Refreshes with maximum available for movement - father.gravity_speed=0; // And gravity is set to 0 - END - END - -END - -//----------------------------------------------------------------------------- -// Process used to check if floor is being touched -// Returns: True/False, Depending if floor is touched or not -//----------------------------------------------------------------------------- - -PROCESS on_screen() - -BEGIN - - IF (map_get_pixel(1,2,father.x/2,father.y/2)==136) - RETURN(TRUE); // If floor is touched, returns true - ELSE - RETURN(FALSE); // If not, returns false - END - -END - -//----------------------------------------------------------------------------- -// Process for first plane objects -// Entries: 'graph' number of graphic -// 'relativex' relative horizontal possition (x) of -// graphic compared to scroll -//----------------------------------------------------------------------------- - -PROCESS first_plane(graph,relativex); - -BEGIN - file=1; - LOOP - y=400-scroll.y0*2; - x=(relativex-scroll.x0)*2; // Finds relative possition respect scroll's - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used to print objects that overlap other objects -// Entries: 'file' graphics file used -// 'graph' number of graphic -// 'x' 'y' Graphic's coordinates 'x' and 'y' -// 'z' Graphic's depth on screen -// 'ctype' Variable used to check it is within scroll -//----------------------------------------------------------------------------- - -PROCESS object(file,graph,x,y,z,ctype); - -BEGIN - LOOP - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used to put bonuses' objects -// Entries: 'x' 'y' objects' coordinates -//----------------------------------------------------------------------------- - -PROCESS p_bonus(x,y); - -BEGIN - ctype=c_scroll; // Puts it within scroll - graph=216; // Puts initial graphic of object - - LOOP // Plays graphics' animation - graph++; - IF (graph>220) - graph=216; - END - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used to put stars' objects -// Entries: 'x' 'y' Initial stars' coordinates -//----------------------------------------------------------------------------- - -PROCESS stars(x,y); - -PRIVATE - incr_x; // Horizontal increment - n_stars; // Number of stars (counter) - -BEGIN - ctype=c_scroll; // Puts within scroll - graph=200; // Puts initial star's graphic - - FROM n_stars=0 TO 11; // Creates 12 stars equally - CLONE - BREAK; - END - END - - incr_x=rand(-6,6); // Chooses randomly an horizontal increment - gravity_speed=rand(-24,-8); // And vertical too - n_stars=32; - - WHILE (n_stars-->0); // While there are stars left (n_stars= number of stars) - // Plays graphics' animation - graph++; - IF (graph>204) graph=200; END - x+=incr_x; // Moves stars horizontally - y+=gravity_speed; // And vertically - gravity_speed+=2; // And reduces vertical increment (gravity) - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process used to put bears' objects -// Entries: 'x' 'y' Objects' coordinates -// 'incr_x' Horizontal increment (to the left and right) -//----------------------------------------------------------------------------- - -PROCESS bear(x,y,incr_x); - -BEGIN - graph=300; // Number of graphic - ctype=c_scroll; // Puts it within scroll - LOOP - - // Plays a bear sound from time to time (randomly) - IF (rand(0,48)==0) play_sound(s_bear,50,256); END - x+=incr_x; // Moves graphic horizontally - - // If the end of platform has been reached - IF (NOT on_screen()) - incr_x=-incr_x; // Changes horizontal increment - x+=incr_x*2; // Moves the graphic a little bit - // Turns graphic to the opposite side - IF (flags==0) - flags=1; - ELSE - flags=0; - END - END - - // Plays graphics' animation - graph++; - IF (graph>304) graph=300; END - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used to put pumpkins' objects -// Entries: 'x' Object's x coordinates -// 'last_y' Special object's y coordinate -// 'incr_x' Horizontal increment (direction left/right) -//----------------------------------------------------------------------------- - -PROCESS pumpkin(x,last_y,incr_x); - -PRIVATE - anim; // Makes animation to be intermittent - jump=-5; // Variable to process pumpkin's jumps - y_temp; // Temporary variable for y - -BEGIN - graph=340; // Selects initial graphic - ctype=c_scroll; // Introduces object within scroll - y=last_y; // Loads 'y' with process' entry ('y' special) - - LOOP - // Plays bear's sound from time to time (rand) - IF (rand(0,48)==0) play_sound(s_bear,30,512); END - x+=incr_x; // Moves graphic horizontally - y_temp=y; // Stores 'y' temporaly to check platforms - y=last_y; // And loads it with initial 'y' - - // If it gets out of the platform where it is - IF (NOT on_screen()) - incr_x=-incr_x; // Changes direction - x+=incr_x*2; // And moves it a bit - END - - y=y_temp; // Restores refreshed 'y' - y+=jump; // Adds jump to 'y' - jump++; // Increments 'y' to move graphic - IF (jump==6) // Checks if limit has been reached - jump=-5; // To start again - END - - - IF (anim) // Checks if it must animate the graphic - graph++; // Animates graphics - IF (graph>344) - graph=340; - END - END - - anim=NOT anim; // Makes animation a little bit slower - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used for shooting heads' objects -// Entries: 'x' 'y' Graphic's coordinates -// 'flags' Direcci˘n hacia donde mira el gr fico -// 'f_pause' Number of frames it is paused -//----------------------------------------------------------------------------- - -PROCESS head(x,y,flags,f_pause); - -BEGIN - ctype=c_scroll; // Puts it within scroll - z=2; // Puts it over other graphics - - LOOP - graph=350; // Selects initial graphic - FRAME(f_pause*100); // Waits indicated frames (f_pause=frames) - - WHILE (graph<355) // Animates it until reaches limit - graph++; - FRAME(200); // Waits two frames - END - - // Plays sound of horizontal drops shooting - play_sound(s_touch,20,768); - // Makes horizontal drops shots - head_shot(x+20-flags*40,y,4-flags*8,flags); - END - -END - -//----------------------------------------------------------------------------- -// Process used for horizontal drops shooting -// Entries: 'x' 'y' Objects coordinates -// 'incx' Horizontal incremento (direction) -// 'flags' Position to which graphic is facing -// horizontally -//----------------------------------------------------------------------------- - -PROCESS head_shot(x,y,incx,flags); - -BEGIN - ctype=c_scroll; // Puts it within scroll - graph=356; // Select appropiate graphic - - REPEAT - x+=incx; // Moves it horizontally - FRAME; - UNTIL (out_region(id,0)) // Until it gets out of screen - -END - -//----------------------------------------------------------------------------- -// Process used for bees and ghost objects -// Entries: 'gr' Type of graphic (bee/ghost) -// 'flags' Type of transparency -// 'relativex' Reference 'x' position -// 'relativey' Reference 'y' position -// 'incx' 'incy' Frecuency of turn on both axis -// 'distx' 'disty' Distance of turn on both axis -//----------------------------------------------------------------------------- - -PROCESS flying(gr,flags,relativex,relativey,incx,incy,distx,disty); - -PRIVATE - angle3; - id2; - -BEGIN - graph=gr; // Selects initial graphic - ctype=c_scroll; // Puts within scroll - - LOOP - // Plays a sound from time to time - IF (rand(0,48)==0) - // Ghost's sound - IF (flags==4) - play_sound(s_ghost,50,256); - // Bee's sound - ELSE - play_sound(s_bee,150,256); - END - END - - angle2+=pi/incx; // Finds size increments - angle3+=pi/incy; // that will be done on both coordinates - x=relativex+get_distx(angle2,distx); // Increments x coordinate - y=relativey+get_disty(angle3,disty); // Increments y coordinate - - // Plays graphics' animation - graph++; - IF (graph==gr+6) - graph=gr; - END - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used for bubble's objects -// Entries: 'x' 'y' Objects coordinates on screen -//----------------------------------------------------------------------------- - -PROCESS bubble(x,y); - -BEGIN - z=64; // Puts graphics a little bit behind - // so they are overlapped by cauldron - graph=430; // Selects graphic - ctype=c_scroll; // Puts it within scroll - WHILE (size>0) // While size (rescaling) is greater thab zero - y-=2; // Moves object upwards - size-=2; // And reduces it's size - FRAME; - END -END - -//----------------------------------------------------------------------------- -// Process used for fish's objects -// Entries: 'x' Object's horizontal coordinate -// 'relativey' Graphic's special vertical coordinate -//----------------------------------------------------------------------------- - -PROCESS fish(x,relativey); - -PRIVATE - incr_y; // Graphic's vertical increment - -BEGIN - z=-10; - splash(x,relativey); // Puts a splash of water - graph=410; // Takes initial fish graphic - ctype=c_scroll; // Puts it within scroll - y=relativey; // Refreshes with process' entry - incr_y=-12; // Initializes increment (upwards) - // Plays fishes' sound - play_sound(s_fish,25,512); - - // While movement limit is not reached - WHILE (incr_y<12) - // Plays graphic's animation, while moving (incr_y<>0) - IF (incr_y AND graph<416) - graph++; - END - y+=incr_y; // Moves graphic vertically - incr_y++; // Refreshes vertical increment - FRAME; - END - splash(x,relativey); // Puts a splash of water -END - -//----------------------------------------------------------------------------- -// Process used to play sounds -// Entries: 'x' Sound's identifier -// 'volume' Sound's volume -// 'frecuency' Sound's frecuency -//----------------------------------------------------------------------------- - -PROCESS play_sound(x,volume,frecuency); - -BEGIN - // If graphic is on screen, plays sound - IF (NOT (out_region(father,0))) - sound(x,volume,frecuency); - END -END - -//------------------------------------------------------------------------------ -// Process used to put splash objects -// Entraies: 'x' 'y' Object's coordinates -//------------------------------------------------------------------------------ - -PROCESS splash(x,y); - -BEGIN - ctype=c_scroll; // Put within scroll - // Plays graphic's animation - FROM graph=400 TO 405; - FRAME(200); // Waits two frames - END -END - -//----------------------------------------------------------------------------- -// Process used for spider's objects -// Entries: 'x' 'y' Object's coordinates -// 'height' Object's height -//----------------------------------------------------------------------------- - -PROCESS spider(x,y,height); - -PRIVATE - counter; // General purpouse counter - -BEGIN - z=-11; - ctype=c_scroll; // Puts it within graphic - graph=330; // Selects initial graphic - height=(height/4)*4; // Makes height multiple of four - - LOOP - FROM counter=0 TO 47; - // Plays spider animation from time to time (rand) - IF (rand(0,10)==0) - graph++; - IF (graph>335) graph=330; END - END - FRAME; - END - - // Plays spider's sound - play_sound(s_spider,200,256); - // Moves object downwards 4 by 4 with the graphic static - FOR (counter=0;counter335) - graph=330; - END - FRAME; - END - END -END - -//----------------------------------------------------------------------------- -// Process used for chains' objects -// Entries: 'x' 'y' Objects coordinates -// 'ang' Object's initial angle -// 'iang' Increment speed within angle -// 'focus' Total angle size (min-max) -//----------------------------------------------------------------------------- - -PROCESS chain(x,y,ang,iang,focus); - -BEGIN - priority=10; // Sets a lower priority than platform's - ctype=c_scroll; // Puts graphic within scroll - file=1; // Selects graphics' file 1 - graph=14; // Takes chain graphic - z=20; // Puts graphic behind platform - platform(); // Creates a platform - - LOOP - ang+=iang; // Increments angle - // Takes cos angle to make a pendular movement with different velocities - angle=get_distx(ang,focus); - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process used for platform objects -//----------------------------------------------------------------------------- - -PROCESS platform() - -BEGIN - priority=9; // Sets higher priority than chain's one - ctype=c_scroll; // Puts object within scroll - file=1; // Uses graphics file 1 - graph=15; // Takes platform graphic - z=19; // Puts graphic over chain - - LOOP - // Takes platform coordinates respect chain's ones - speed=father.x+get_distx(father.angle-pi/2,130)-x; - x+=speed; - y=father.y+get_disty(father.angle-pi/2,130); - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process for metallic platform objects -// Entries: 'x1' 'y1' Initial platform coordinates -// 'x2' 'y2' Final platform coordinates -// 'istep' % increment (speed) -//----------------------------------------------------------------------------- - -PROCESS metal_platform(x1,y1,x2,y2,istep); - -PRIVATE - _step; // Process movement counter (indicates where on the animation it is) - -BEGIN - priority=10; // Gives a low priority - ctype=c_scroll; // Puts graphic within scroll - file=1; // Selects graphics file 1 - graph=16; // Selects metallic platform graphic - x=x1; // Introduces initial coordinates - y=y1; - - LOOP - // Refreshes new coordinates - x=(x1*_step+x2*(100-_step))/100; - y=(y1*_step+y2*(100-_step))/100; - // Adds the necessary increment - _step+=istep; - // If 100% has been reached - IF (_step MOD 100==0) - istep=-istep; // Changes direction - play_sound(s_star,12,512); // Plays stars' sound - END - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process used for first level final boss monster object -//----------------------------------------------------------------------------- - -PROCESS malvado_son(); - -PRIVATE - counter; // General purpouse counter - regionx=96; // Necessary for screen centering - -BEGIN - file=1; // Selects first graphics' file - ctype=c_scroll; // Introduces graphic within scroll - x=3800; // Takes coordinates - y=261; - z=8; // Chooses depth (behind) - graph=104; // Chooses initial graphic - malvado_son_head(); // Creates monster's head - - // Modifies scroll's movement region - // to center it, with monster, on the center of screen - WHILE (regionx<160); // Modifies it little by little (smoothly) - define_region(1,++regionx,100,1,1); - FRAME; - END - - LOOP - graph=104; // Selects initial graphic - flags=0; // With no mirror at all - FRAME(5000); // Puts the graphic and waits 50 frames (1 sec) - graph=105; // Puts graphic of shooting ball - FRAME(400); // Prints it and waits 4 frames - graph=106; // Puts graphic of shooted ball - ball(x-16,y-30,-6); // Creates fire ball - FRAME(400); // Waits 4 frames - graph=105; // Puts the recovering graphic - FRAME(400); // Waits 4 frames - graph=104; // Puts initial graphic - FRAME(5000); // Waits 50 frames - graph=107; // Puts ready to jump graphic - // Moves graphic (jumps) - FROM counter=-16 TO 16; - y+=counter; - x-=10; - FRAME; - END - // Plays touch sound - sound(s_touch,150,256); - graph=104; // Initial graphic - flags=1; // Mirrors so it faces Jack - FRAME(5000); // Repeats previous process - graph=105; - FRAME(400); - graph=106; - ball(x+16,y-30,6); - FRAME(400); - graph=105; - FRAME(400); - graph=104; - FRAME(5000); - graph=107; - FROM counter=-16 TO 16; - y+=counter; - x+=10; - FRAME; - END - // Touch sound played - sound(s_touch,150,256); - END -END - -//----------------------------------------------------------------------------- -// Process used for first level monster's head object -//----------------------------------------------------------------------------- - -PROCESS malvado_son_head(); - -PRIVATE - angle0; // Variable used to move head in an alliptical way - id2; // Jack's identifier and monster's body at the end (when monster is dead) - // Creates a variable chain of 50 positions for graphics animation - anim[]=40 DUP (100),101,101,102,102,103,103,102,102,101,101; - ianim; // Counter inside chain animation - incy=0; // Variable used to move head up and down - // when Jack touches it and eliminates body - // when the level is over -BEGIN - file=1; // Selects graphics file 1 - graph=100; // Puts initial graphic - ctype=c_scroll; // Puts it within scroll - z=4; // Depth over body, and behind Jack - REPEAT - // Puts head backwards respect body, to place it - IF (father.flags==1) flags=0; ELSE flags=1; END - x=father.x+get_distx(angle0,6); // Takes coordinates respect body - y=father.y-70+get_disty(angle0,4);// But with an elliptical movement - graph=anim[ianim]; // Takes the necessary graphic for the animation - ianim=(ianim+1) mod 50; // Increments counter within chain animation - - // Plays bear's sound after 40 animations - IF (ianim==40) sound(s_bear,100,128); END - angle0+=pi/48; - - // Checks if Jack has been touched - IF (id2=collision(TYPE jack)) - // If Jack is higher than monster - // and if Jack is alive - IF (id2.death AND id2.y<=y) - incy=64; // Moves down monster's head - id2.gravity_speed=-26; // Changes gravity - score++; // Adds points - energy_enemy--; // Subtracts energy to monster - stars(x,y); // Puts 'wonderful' stars - sound(s_bubble,100,256); // Plays bubble's sound - END - END - - // Moves monster's head up, if this was down - IF (incy>0) - y+=incy/2; - FRAME; - incy--; - ELSE - FRAME; - END - UNTIL (energy_enemy==0) // Repeats while monster has energy left - - s_malvado=load_pcm("malvado\malvado.pcm",0); // Malvado's death sound - // Creates monster's body - id2=object(1,104,father.x,father.y,8,1); - signal(father,s_kill); // And eliminates previous body - incy=-24; // Increments y body coordinate - sound(s_malvado,128,256); // Plays sound - REPEAT - id2.y+=(incy/2); // Moves body - incy++; // Reduces falling speed - y=id2.y-56; // Moves head - IF (incy MOD 8==0) // Creates stars every 8 animation - stars(x,y); - END - FRAME; - UNTIL (y>350); // While head doesn't reach the floor - - // Sets variable to one, to indicate that the level is over - level_end=true; -END - - -//----------------------------------------------------------------------------- -// Process used for level three final monster's object -//----------------------------------------------------------------------------- -PROCESS malvado(); - -PRIVATE - counter; // General purpouse counter - headid; // Identifier for monster's head - -BEGIN - file=1; // Takes graphics file 1 - ctype=c_scroll; // Puts object within scroll - x=552; // Initializes object's coordinates - y=230; - z=8; // Puts body behind (depth) head - headid=malvado_head(); // Creates monster's head - - LOOP - graph=200; // Puts initial graphic - flags=0; // Puts it facing Jack (by default) - FRAME(5000); // Waits 50 frames (1 sec aprox.) - graph=203; // Changes graphic to animate it - FRAME(300); // Waits 3 frames - graph=204; // Changes graphic to animate it - FRAME(300); // Waits 3 frames - graph=205; // Changes graphic of monster shooting bombs - bomb(x-38,y+24,-6); // Creates a bomb object - FRAME(400); // Waits 4 frames - graph=200; // Changes graphic to animate it (initial) - FRAME(5000); // Waits 50 frames - graph=201; // Changes graphic - headid.graph=101; // Changes monster's head graphic - FROM counter=-16 TO 16; - // If it is at the middle of animation - IF (counter==0) - graph=202; // Changes body graphic - headid.graph=102; // Changes head graphic - END - // Moves monster (jump) - y+=counter; - x-=14; - FRAME; - END - - headid.graph=100; // Changes head's graphic - sound(s_touch,150,256); // Plays touch sound - graph=200; // Initial graphic - flags=1; // Puts it facing Jack - FRAME(5000); // Repeats previous animation - graph=203; - FRAME(300); - graph=204; - FRAME(300); - graph=205; - bomb(x+38,y+24,6); // Creates bomb - FRAME(400); - graph=200; - FRAME(5000); - // Jumps again to the other side - graph=201; - headid.graph=101; - FROM counter=-16 TO 16; - IF (counter==0) - graph=202; - headid.graph=102; - END - y+=counter; - x+=14; - FRAME; - END - - headid.graph=100; - // Plays touch sound - sound(s_touch,150,256); - END -END - - -//----------------------------------------------------------------------------- -// Process used for monster's head object -//----------------------------------------------------------------------------- - - -PROCESS malvado_head(); - -PRIVATE - angle0; // For elliptical movement - id2; // Identifier for creating a new body - incy; // To put head down and eliminate monster at the end - // if Jack touches it or kills him -BEGIN - file=1; // Selects graphics file 1 - graph=100; // Selects initial graphic - ctype=c_scroll; // Puts object within scroll - z=4; // Puts head over body - - REPEAT - flags=father.flags; // Takes body position (left/right) - x=father.x-18+flags*36+get_distx(angle0,6); // Takes coordinates respect body's ones - y=father.y-32+get_disty(angle0,4); // but with an elliptical movement - angle0+=pi/48; // Increments elliptical movement - FRAME; - UNTIL (energy_enemy==0) // While monster has energy - - s_malvado=load_pcm("malvado\malvado.pcm",0); // Plays Malvado's death sound - // Creates a new monster body - id2=object(1,202,father.x,father.y,8,1); - // To eliminate body's head - signal(father,s_kill); - incy=-24; // Selects downwards speed (increment) - graph=103; // Selects a graphic of dead head - flags=0; // Eliminates any type of mirror effect - sound(s_malvado,100,256); // Plays sound - REPEAT - id2.y+=incy/2; // Moves body (downwards) - incy++; // Each time slower - y=id2.y-32; // Moves head downwards - x=id2.x-18; // And leftwards - // Puts stars each 8 animations - IF (incy mod 8==0) - stars(x,y); - END - FRAME; - UNTIL (y>350); // Repeats while head doesn't touch floor - level_end=true; // Indicates that the level is over -END - -//----------------------------------------------------------------------------- -// Process used for balls level1's monster throws -// Entries: 'x' 'y' Objects coordinates -// 'incr_x' Movement increment (left/right) -//----------------------------------------------------------------------------- - -PROCESS ball(x,y,incr_x); - -BEGIN - file=1; // Selects graphics file 1 - graph=108; // Puts fire ball graphic - ctype=c_scroll; // Puts it within scroll - z=4; // Before body and head, and behind Jack - sound(s_touch,100,128); // Plays touch sound - - REPEAT - x+=incr_x; // Moves object - graph++; - // Plays graphics' animation - IF(graph>110) graph=108; END - FRAME; - UNTIL (x<3000 OR x>4000) // Repeats until it gets out of screen - -END - -//----------------------------------------------------------------------------- -// Process used for bombs thrown by level3's monster -// Entries: 'x' 'y' Objects coordinates -// 'inc' Horizontal increment (left/right) -//----------------------------------------------------------------------------- - - -PROCESS bomb(x,y,incr_x); - -PRIVATE - incr_y; // Bomb's vertical position - iymax; // Bomb's maximum vertical position - id2; // Identifier for collisions - _touch=false; // Variable used to check the bomb was thrown by the monster - // or Jack - -BEGIN - file=1; // Selects graphics file 1 - graph=300; // Puts initial graphic - ctype=c_scroll; // Puts it within scroll - z=4; // Puts it behind Jack and over monster - iymax=rand(-10,-22); // Random maximum height for bomb - incr_y=iymax; // Starts on maximum height - sound(s_touch,50,128); // Plays touch sound - - REPEAT - y+=incr_y; // Moves bomb - incr_y+=2; - // Makes bomb bounce - IF (incr_y>-iymax) - iymax+=2; - incr_y=iymax; - sound(s_touch,25,768); // Plays touch sound - END - x+=incr_x; - - // If the bomb was thrown by the monster - IF (NOT _touch) - // If Jack touches it - IF (id2=collision(TYPE jack)) - _touch=TRUE; - // If Jack is alive - IF (id2.death) - incr_x=-incr_x; // Changes bomb's direction - id2.gravity_speed=-20; // Makes Jack bounce - stars(x,y); // Puts stars - score++; // Adds score - sound(s_bubble,25,512); // Puts bubble sound - ELSE - kill_jack2(); // If not, Jack dies - END - END - END - - // Bomb touches monster, and subtracts him energy - IF (id2=collision(TYPE malvado)) - energy_enemy--; - BREAK; - END - - FRAME; - // Repeats process until bomb is out of screen - UNTIL (x<64 OR x>640-64 OR iymax>=0) - - // Plays touch sound - sound(s_touch,200,128); - // Plays animation - FROM graph=301 TO 309; - frame(200); // Waits two frames per graphic - END - -END - -//----------------------------------------------------------------------------- -// Process used for fire's object -// Entries: 'x' 'y' Objects coordinates -// 'inc' Maximum movement object will do -//----------------------------------------------------------------------------- - -PROCESS fire(x,y,inc) - -PRIVATE - counter; // General purpouse counter - -BEGIN - ctype=c_scroll; // Puts graphic within scroll - LOOP - graph=0; // Selects a null graphic - flags=0; // With no mirror effect type at all - FROM counter=0 TO 23; // Puts 24 graphics - FRAME; - END - - graph=420; // Selects initial graphic - play_sound(s_touch,50,128); // Plays touch sound - - FOR (counter=-inc;counter<=inc;counter++); // Moves up to increment - IF (graph==420) // Alternates graphics - graph=421; // If it is not there, puts it - ELSE // And if it is ther - graph=420; // Eliminates it - END - IF (counter==1) // If top was reached - flags=2; // Turns graphic upside-down (facing down) - END - FRAME; - y+=counter; // Moves object - END - - END -END - -//----------------------------------------------------------------------------- -// Process used for bar energy's object -//----------------------------------------------------------------------------- - -PROCESS energy_bar(); - -BEGIN - graph=10; // Selects initial graphic - x=160; // Puts coordinates - y=220; - z=-9; // Puts energy bar over all graphics - - WHILE (energy_enemy>0) // While there is any energy left - // Rises energy bar from outside of screen to it's position - IF (y>190) - y--; - ELSE - IF (region!=10) // If it doesn't have a region, creates one - region=10; - object(0,11,160,190,-10,0); // Creates the empty bar behind - END - END - // Defines region respect energy bar's size - // so you only see the area that represents it - define_region(10,120,185,1+energy_enemy*5,10); - FRAME; - END - - // Eliminates the process of the bar that is behind (empty bar) - signal(son,s_kill); -END - -//----------------------------------------------------------------------------- -// Process used for spike ball's object -// Entries: 'x' 'y' Object's coordinates -//----------------------------------------------------------------------------- - -PROCESS spikes_ball(x,y) - -BEGIN - file=1; // Selects graphics file 1 - graph=20; // Selects initial graphic - ctype=c_scroll; // Puts object within scroll - priority=100; // Sets a low priority to connect with chain - chain_ball(id,20); // Creates spikes chain - z=-20; // Puts it over the screen - - LOOP - angle2+=pi/64; // Moves the chain and the spikes ball - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process used for the chain object that links with spikes ball -// Entries: '_first' Identifier to the link point -// '_distance' Distance to link -//----------------------------------------------------------------------------- - -PROCESS chain_ball(_first,_distance) - -BEGIN - file=1; // Selects graphics file 1 - graph=21; // Selects initial graphic - ctype=c_scroll; // Puts object within scroll - z=-10; // Puts chain behind link - - IF (_distance<80) // If remaining size is enough big - chain_ball(_first,_distance+20); // Creates another chainball - ELSE - ball_end(_first,_distance+32); // If not, creates the final spikes ball - END - - LOOP - angle2=_first.angle2; // Takes link angle - x=_first.x+get_distx(angle2,_distance); // Finds coordinates after - y=_first.y+get_disty(angle2,_distance); // link and angle - FRAME; - END - -END - -//----------------------------------------------------------------------------- -// Process used for the final spikes ball object -// Entries: '_first' Identifier to the link point -// '_distance' Distance to link -//----------------------------------------------------------------------------- - -PROCESS ball_end(_first,_distance) - -BEGIN - file=1; // Selects graphics file 1 - graph=22; // Puts initial graphic - ctype=c_scroll; // within scroll - z=-20; // Before chain - - LOOP - angle2=_first.angle2; // Takes link angle - x=_first.x+get_distx(angle2,_distance); // Refreshes coordinates after - y=_first.y+get_disty(angle2,_distance); // the distance to link and the angle - // Plays stars' sound - play_sound(s_star,10,768); - FRAME; - END - -END diff --git a/examples/games/pacoman/Pacoman.prg b/examples/games/pacoman/Pacoman.prg deleted file mode 100644 index b67ff46..0000000 --- a/examples/games/pacoman/Pacoman.prg +++ /dev/null @@ -1,870 +0,0 @@ -compiler_options _extended_conditions; - - -//------------------------------------------------------------------------------ -//TITLE: PACOMAN -//AUTHOR: DANIEL NAVARRO -//DATE: DIV GAMES STUDIO (c) 2000 -//------------------------------------------------------------------------------ - -PROGRAM pacoman; - -GLOBAL - - - time_capsules[]=0,300,240,180,140,120,100,80,60,40,0; - - - intelligence[]=0,10,30,50,65,75,85,90,95,100,100; - - - fruit_value[]=0,100,300,500,500,700,700,1000,1000,2000,2000; - - - g_fruit_value[]=0,54,55,56,56,57,57,58,58,59,59; - - - g_fruit[]=0,48,49,50,50,51,51,52,52,53,53; - - old_score=0; - score=0; // fff - level; - points=0; - - lives[10]; - ilives=0; - score_max=10000; - idpaco; - - s_beginning; - s_eat_ghost; - s_eat_fruit; - s_eat_point; - s_eat_pointgr; - s_begins; - s_death; - channel_s_beginning; - - -LOCAL - state=0; - model; - -BEGIN - set_mode(m640x480); - - s_eat_ghost=load_pcm("pacoman/comefant.pcm",0); - s_eat_fruit=load_pcm("pacoman\comefrut.pcm",0); - s_eat_point=load_pcm("pacoman\comecoco.pcm",0); - s_eat_pointgr=load_pcm("pacoman\comegcoc.pcm",0); - s_begins=load_pcm("pacoman\comienzo.pcm",0); - s_death=load_pcm("pacoman\muerto.pcm",0); - s_beginning=load_pcm("pacoman\tambor2.pcm",1); - - load("pacoman\pacoman.dat",&score_max); - - - define_region(1,105,0,640-209,480); - - //load_pal(/*"/*pacoman\ */"pacoman.fpg"); - load_fpg("pacoman/pacoman.fpg"); - force_pal("pacoman/pacoman.fpg"); - - //load_fnt("zx81.FNT"); - - - load_fnt("pacoman/pacoman.FNT"); - - //load_fnt("pacoman\pacoman.fnt"); - - power_pill(128,56); - power_pill(512,56); - power_pill(128,364); - power_pill(512,364); - - - - WHILE (NOT (key(_esc))) - - - channel_s_beginning=sound(s_beginning,512,256); - - level=1; - - - xput(0,1,320,240,0,100,4,0); - - titles(write(1,320,320,1,"Press a key to play")); - write(1,320,80,1,"High Score"); - write_int(1,320,110,1,&score_max); - write(1,320,430,1,"(c)2000 DIV GAMES"); - - ghost(320,177,12); - son.flags=son.flags OR 4; - ghost(290,223,16); - son.flags=son.flags OR 4; - ghost(320,223,20); - son.flags=son.flags OR 4; - ghost(352,223,24); - son.flags=son.flags OR 4; - - fade_on(); - - //write_int(0,0,8,0,&scan_code); - WHILE (scan_code==0) - FRAME; - END - - IF (key(_esc)) - fade_off(); - exit("Thanks for playing!",0); - END - - - stop_sound(channel_s_beginning); - - - fade_off(); - let_me_alone(); - delete_text(all_text); - - power_pill(128,56); - power_pill(512,56); - power_pill(128,364); - power_pill(512,364); - - clear_screen(); - put(0,1,320,240); - - xput(0,47,56,260,pi/2,100,0,0); - xput(0,47,585,260,-pi/2,100,0,0); - - write_int(1,100,0,2,&score); - - ilives=0; - lives[ilives]=life((ilives*26)+552); - ilives++; - lives[ilives]=life((ilives*26)+552); - ilives++; - - points=0; - score=0; - - beginning_play(); - - - - WHILE (ilives>=0 AND NOT key(_esc)) - - IF (points==246) - level++; - level=level MOD 11; - fade_off(); - let_me_alone(); - - power_pill(128,56); - power_pill(512,56); - power_pill(128,364); - power_pill(512,364); - - put(0,1,320,240); - - points=0; - beginning_play(); - END - - - IF (points==100 OR points==200) - fruit(); - points++; - END - - - IF (score>=10000 AND old_score<10000) - lives[ilives]=life(ilives*26+552); - ++ilives; - END - - - IF (score>=50000 AND old_score<50000) - lives[ilives]=life(ilives*26+552); - ++ilives; - END - - old_score=score; - - FRAME; - END - let_me_alone(); - - - write(1,320,197,1,"Game Over"); - FRAME(4000); - fade_off(); - delete_text(all_text); - clear_screen(); - - - IF (score>score_max) - score_max=score; - - save("dat\pacoman\pacoman.dat",&score_max,1); - END - END -END - - - - - - -PROCESS paco() - -PRIVATE - image; - speed_paco=2; - incr_x=0; - incr_y=0; - counter0; - eaten; - old_graphic; - steps[]=0,1,2,1; - step2=0; - initial_graphic=3; - points_eaten=200; - -BEGIN - idpaco=id; - region=1; - graph=3; - x=320; - y=364; - LOOP - - IF (key(_space)) - speed_paco=4; - ELSE - speed_paco=2; - END - - - IF (key(_right) AND way_paco(x+2,y)) - initial_graphic=3; - flags=0; - incr_x=2; - incr_y=0; - END - - - IF (key(_left) AND way_paco(x-2,y)) - initial_graphic=3; - flags=1; - incr_x=-2; - incr_y=0; - END - - - IF (key(_down) AND way_paco(x,y+2)) - initial_graphic=6; - flags=0; - incr_y=2; - incr_x=0; - END - - - IF (key(_up) AND way_paco(x,y-2)) - initial_graphic=6; - flags=2; - incr_y=-2; - incr_x=0; - END - - - IF (way_paco(x+incr_x,y)) - x+=incr_x; - ELSE - incr_x=0; - step2=1; - END - - - IF (way_paco(x,y+incr_y)) - y+=incr_y; - ELSE - incr_y=0; - step2=1; - END - - - graph=initial_graphic+steps[step2]; - - - IF (image>=speed_paco) - FRAME; - image=0; - - IF (eaten=collision(TYPE ghost)) - - - IF (abs(x-eaten.x)>10 OR abs(y-eaten.y)>10) - eaten=0; - END - - END - - IF (incr_x<>0 OR incr_y<>0) - step2=(step2+1) MOD 4; - END - END - image++; - - - IF (x<=95) - x+=450; - END - - IF (x>=546) - x-=450; - END - - - IF (point(x,y)==14) - points++; - score+=10; - put(0,9,x,y); - image++; - sound(s_eat_point,128,256); - END - - - IF (point(x,y)==10) - sound(s_eat_pointgr,512,256); - points++; - score+=50; - points_eaten=0; - - put(0,10,x,y); - - - WHILE (counter0=get_id(TYPE ghost)) - counter0.state=time_capsules[level]; - END - END - - - IF (eaten) - IF (eaten.state>0) - sound(s_eat_ghost,512,256); - - - WHILE (counter0=get_id(TYPE ghost)) - signal(counter0,s_freeze); - END - - old_graphic=graph; - graph=0; - eaten.graph=42+points_eaten; - - FRAME(1500); - - - WHILE (counter0=get_id(TYPE ghost)) - signal(counter0,s_wakeup); - END - graph=old_graphic; - eyes(eaten.x,eaten.y,eaten.model); - signal(eaten,s_kill); - SWITCH (points_eaten); - CASE 0: score+=200; END - CASE 1: score+=400; END - CASE 2: score+=800; END - CASE 3: score+=1600; END - CASE 4: score+=3200; END - END - points_eaten++; - ELSE - - - WHILE (counter0=get_id(TYPE ghost)) - signal(counter0,s_freeze); - END - FRAME(1500); - - - signal(TYPE ghost,s_kill); - signal(TYPE eyes,s_kill); - signal(TYPE fruit,s_kill); - flags=0; - sound(s_death,512,256); - FROM counter0=34 TO 41; - graph=counter0; - FRAME(400); - END - FRAME(800); - IF (ilives<>0) - signal(lives[ilives],s_kill); - ilives--; - beginning_play(); - ELSE - ilives--; - END - signal(id,s_kill); - FRAME; - END - eaten=0; - END - END -END - - - - - - -PROCESS way_paco(x,y) - -PRIVATE - colour_number; - -BEGIN - colour_number=colour(x,y); - RETURN(colour_number==10 OR - colour_number==12 OR - colour_number==14); -END - - - - - - -PROCESS point(x,y) - -BEGIN - IF (get_pixel(x,y)==16) - RETURN(0); - ELSE - RETURN(colour(x,y)); - END -END - - - - - - -PROCESS way_ghost(x,y,dir) - -PRIVATE - n_colour; - -BEGIN - - SWITCH (dir) - CASE 0: n_colour=colour(x-2,y); END - CASE 1: n_colour=colour(x+2,y); END - CASE 2: n_colour=colour(x,y+2); END - CASE 3: n_colour=colour(x,y-2); END - END - - - IF (n_colour==11 AND dir==2 AND colour(x,y)==12) - n_colour=0; - END - - - RETURN(n_colour==11 OR n_colour==10 OR n_colour==12 OR n_colour==14); -END - - - - - - -PROCESS colour(x,y) - -BEGIN - - IF ((x<105 OR x>534) AND (y==225 OR y==226)) - RETURN(12); - END - - - RETURN(map_get_pixel(0,2,(x-105)/2,(y-1)/2)); -END - - - - - - -PROCESS ghost(x,y,model) - -PRIVATE - image; - num_imagees; - dir=3; - -BEGIN - region=1; - - LOOP - - IF (colour(x,y)==11 OR state>0) - num_imagees=1; - ELSE - num_imagees=2; - END - - - IF (counts_dir(x,y)>2) - dir=selects_dir(x,y,dir); - ELSE - - IF (NOT way_ghost(x,y,dir)) - dir=selects_dir(x,y,dir); - END - - - IF (rand(0,1000)<2) - dir=selects_dir(x,y,dir XOR 1); - END - END - - SWITCH (dir) - CASE 0: x-=2; END - CASE 1: x+=2; END - CASE 2: y+=2; END - CASE 3: y-=2; END - END - - - IF (x<=95) x+=450; END - IF (x>=546) x-=450; END - - - IF (state==0) - graph=model+dir; - ELSE - - IF (state<70 AND state/7) - graph=28; - ELSE - graph=11; - END - state--; - END - - - IF (image>=num_imagees) - FRAME; - image=0; - END - image++; - END -END - - - - - - -PROCESS selects_dir(x,y,old_dir) - -PRIVATE - dir[3]; - num_dir=0; - counter0=0; - dir1; - dir2; - -BEGIN - - - FROM counter0=0 TO 3; - - IF (way_ghost(x,y,counter0) AND old_dir<>(counter0 XOR 1)) - dir[num_dir]=counter0; - num_dir++; - END - END - - - IF (num_dir==0) - dir[num_dir]=old_dir XOR 1; - num_dir++; - END - - - counter0=dir[rand(0,num_dir-1)]; - - IF (rand(0,100)abs(idpaco.y-father.y)) - - IF (idpaco.x>father.x) - dir1=1; - ELSE - dir1=0; - END - IF (idpaco.y>father.y) - dir2=2; - ELSE - dir2=3; - END - ELSE - IF (idpaco.y>father.y) - dir1=2; - ELSE - dir1=3; - END - IF (idpaco.x>father.x) - dir2=1; - ELSE - dir2=0; - END - END - END - ELSE - - - IF (abs(idpaco.x-father.x)father.x) - dir1=0; - ELSE - dir1=1; - END - IF (idpaco.y>father.y) - dir2=3; - ELSE - dir2=2; - END - ELSE - - IF (idpaco.y>father.y) - dir1=3; - ELSE - dir1=2; - END - IF (idpaco.x>father.x) - dir2=0; - ELSE - dir2=1; - END - END - END - - - IF (old_dir==dir1 AND way_ghost(x,y,dir1)) - RETURN(dir1); - ELSE - IF (NOT way_ghost(x,y,dir1) AND old_dir==dir2 AND way_ghost(x,y,dir2)) - RETURN(dir2); - END - END - - IF (way_ghost(x,y,dir1) AND old_dir<>(dir1 XOR 1)) - counter0=dir1; - ELSE - IF (way_ghost(x,y,dir2) AND old_dir<>(dir2 XOR 1)) - counter0=dir2; - END - END - END - RETURN(counter0); -END - - - - - - -PROCESS counts_dir(x,y) - -PRIVATE - dir=0; - counter0=0; - -BEGIN - REPEAT - - IF (way_ghost(x,y,counter0)) - dir++; - END - UNTIL (counter0++==3) - RETURN(dir); -END - - - - - - -PROCESS eyes(x,y,model) - -PRIVATE - image; - -BEGIN - LOOP - - IF (x<105) x=105; END - IF (x>554) x=554; END - - - SWITCH (map_get_pixel(0,33,(x-105)/2,(y-1)/2)) - CASE 14: x-=2; graph=29; END - CASE 10: x+=2; graph=30; END - CASE 12: y+=2; graph=31; END - CASE 9: y-=2; graph=32; END - - CASE 11: image=0; signal(id,s_kill); ghost(x,y,model); END - END - - IF ((image AND 3)==0) FRAME; END - image++; - END -END - - - - - - -PROCESS life(x) - -BEGIN - y=14; - graph=4; - LOOP - FRAME; - END -END - - - - - - -PROCESS power_pill(x,y) - -BEGIN - z=10; - LOOP - graph=10; - FRAME(300); - graph=0; - FRAME(300); - END -END - - - - - - -PROCESS fruit() - -PRIVATE - timefruit=100; - -BEGIN - x=320; - y=270; - graph=g_fruit[level]; - z=10; - - - WHILE (timefruit>0) - timefruit--; - - IF (collision(TYPE paco)) - sound(s_eat_fruit,512,256); - timefruit=-20; - score+=fruit_value[level]; - graph=g_fruit_value[level]; - END - FRAME; - END - - - WHILE (timefruit<0) - timefruit++; - FRAME; - END -END - - - - - - -PROCESS titles(txt) - -PRIVATE - - graphics_table[]=50,52,53,54,54,53,52,50,48,47,46,46,47,48; - counter0=0; - -BEGIN - graph=47; - x=320; - z=-10; - LOOP - counter0=(counter0+1) MOD 14; - - - IF (counter0==0) move_text(txt,320,320); END - - - IF (counter0==7) move_text(txt,320,640); END - - y=50+sin(timer[0]*4000)/100;//graphics_table[counter0]; - x=320+cos(timer[0]*4000)/50; - FRAME; - END -END - - - - - - -PROCESS beginning_play() - -PRIVATE - text1; - text2; - text3; - counter0; - -BEGIN - - - stop_sound(all_sound); - fade_on(); - - - sound(s_begins,512,256); - text1=write(1,320,243,1,"Ready!"); - text2=write(1,300,152,1,"Level"); - text3=write_int(1,376,152,1,&level); - // write_int(0,0,0,0,&fps); - FRAME(9000); - - - delete_text(text1); - delete_text(text2); - delete_text(text3); - - - paco(); - ghost(320,177,12); - ghost(290,223,16); - ghost(320,223,20); - ghost(352,223,24); -END diff --git a/examples/games/pool/Pool.prg b/examples/games/pool/Pool.prg deleted file mode 100644 index 60a44ad..0000000 --- a/examples/games/pool/Pool.prg +++ /dev/null @@ -1,754 +0,0 @@ -compiler_options _extended_conditions; - - -//------------------------------------------------------------------------------ -//TITLE: TOTAL POOL -//AUTHOR: DANIEL NAVARRO -//DATE: DIV GAMES STUDIO (c) 2000 -//------------------------------------------------------------------------------ - -PROGRAM spanish_billards; - -CONST - ball_rad=14; - x_reg_pulls=62-ball_rad; - y_reg_pulls=104-ball_rad; - wide_reg_pulls=580-62+ball_rad*2; - stop_reg_pulls=375-104+ball_rad*2; - - pos_touches_x=604; - pos_touches_y=452; - -GLOBAL - score1; - score2; - - target; - yello; - red; - - complete; - who; - turn; - - sound0; - sound1; - - vtotal0; - vtotal1; - choices[]="Select","Effect","Shoot"; - txt_score[]="7 Points","21 Points","40 Points"; - score=0; - scorees[]=7,21,40; - txt_choice; - choice; - id_effects; - effect_vert; - effect_horiz; - opposite_hit=0; - red_hit=0; -LOCAL - speed=0; - aspeed=0; - ang=0; - - x_resol; - y_resol; - - incr_x; - incr_y; - -PRIVATE -  angle2=0; - inc_ angle2=0; - - option=0; - options[2]; - end_play=0; - complete_x; - complete_y; -BEGIN - set_mode(m640x480); - set_fps(30,0); - - load_fpg("pool\billar.fpg"); - load_fpg("pool\b_menu.fpg"); - - load_fnt("pool\billar.fnt"); - load_fnt("pool\numeros.fnt"); - load_fnt("pool\titulo.fnt"); - load_fnt("pool\menu.fnt"); - - sound0=load_pcm("pool\billar0.pcm",0); - sound1=load_pcm("pool\banda.pcm",0); - - - define_region(1,x_reg_pulls,y_reg_pulls,wide_reg_pulls,stop_reg_pulls); - - LOOP - - load_pal("pool\b_menu.fpg"); - put_screen(1,1); - - - write(3,320,4,1,"TOTAL POOL"); - options[0]=write(4,400,320,0,"Start"); - options[1]=write(4,400,354,0,txt_score[score]); - options[2]=write(4,400,388,0,"Exit"); - write(4,320,480,7,"Daniel Navarro DIV Games Studio"); - - - file=1; - graph=2; - - - y=342; incr_y=0;  angle2=0; - option=0; - - fade_on(); - - REPEAT - complete_y=mouse.y; - x=17+get_distx(ang,16); - IF ((ang+=pi/8)>pi) - ang-=2*pi; - END - - - IF (option<>0 AND ang-pi/15) - incr_x=400; - - REPEAT - move_text(options[option-1],incr_x+=16,incr_y); - FRAME; - UNTIL (incr_x>640) - - IF (option==2) - delete_text(options[1]); - score=++score%3; - options[1]=write(4,incr_x=640,incr_y,0,txt_score[score]); - REPEAT - move_text(options[1],incr_x-=16,incr_y); - FRAME; - UNTIL (incr_x==400) - option=0; - incr_y=0; - ELSE - option-=4; - END - END - IF (incr_y==0) - IF (key(_enter) OR mouse.left OR - key(_control) OR key(_space)) - incr_y=y-22; - option=(y-342)/34+1; - ELSE - IF ((key(_down) OR mouse.y>complete_y) AND y<410) - incr_y=y+17; -  angle2=pi/2; - inc_ angle2=-pi/8; - END - IF ((key(_up) OR mouse.y342) - incr_y=y-17; -  angle2=-pi/2; - inc_ angle2=pi/8; - END - END - END - - IF (inc_ angle2<>0) -  angle2+=inc_ angle2; - y=incr_y+get_disty( angle2,17); - IF (inc_ angle2<0) - IF ( angle2<-pi/2) - y=incr_y+17; - incr_y=0; - inc_ angle2=0; - END - ELSE - IF ( angle2>pi/2) - y=incr_y-17; - incr_y=0; - inc_ angle2=0; - END - END - END - - IF (key(_esc)) - option=-1; - END - FRAME; - UNTIL (option<0) - - fade_off(); - clear_screen(); - delete_text(all_text); - graph=0; - FRAME; - - IF (option==-1) - exit("Thanks for Playing!!!",0); - FRAME; - END - - load_pal("pool\billar.fpg"); - - - write(1,12,6,0,"Player 1"); - write(1,628,6,2,"Player 2"); - write_int(2,115,0,0,&score1); - write_int(2,525,0,2,&score2); - - - put(0,1,320,240); - put(0,8,pos_touches_x,pos_touches_y); - - - id_effects=effect(); - - - write(1,12,428,0,"Player"); - write_int(1,98,428,0,&turn); - fade_on(); - - - target=ball(3,320,240); - yello=ball(4,128,240-48); - red=ball(5,128,240+48); - - - - end_play=0; - opposite_hit=0; - red_hit=0; - score1=0; - score2=0; - complete=0; - who=0; - turn=2; - - REPEAT - - IF (target.speed==0 AND yello.speed==0 AND red.speed==0 AND NOT get_id(TYPE cue)) - - - IF (NOT (opposite_hit AND red_hit)) - - IF (turn==1) - turn=2; - ELSE - turn=1; - END - ELSE - - IF (turn) - - IF (++score1==scorees[score]) - x=800; - who=write(1,x,240,4,"Player one win"); - FROM x=800 TO 319 STEP -8; - move_text(who,x,240); - FRAME; - END - FROM x=0 TO 29; - FRAME; - END - end_play=1; - END - ELSE - - IF (++score2==scorees[score]) - x=800; - who=write(1,x,240,4,"Player two win"); - FROM x=800 TO 320 STEP -8; - move_text(who,x,240); - FRAME; - END - FROM x=0 TO 29; - FRAME; - END - end_play=1; - END - END - END - - - IF (NOT end_play) - - IF (turn) - cue(target); - ELSE - cue(yello); - END - opposite_hit=0; - red_hit=0; - END - END - - - IF (key(_esc)) - end_play++; - END - FRAME; - UNTIL (end_play) - - fade_off(); - signal(id,s_kill_tree); - signal(id,s_wakeup); - clear_screen(); - delete_text(all_text); - FRAME; - END -END - - - - - - -PROCESS ball(graph,x,y); - -PRIVATE - id_collisions; - dir_final; - - final_speed_x; - final_speed_y; - - longitude; - - complete_pos_x; - complete_pos_y; - -BEGIN - - shade(6); - - x_resol=x*100; - y_resol=y*100; - - LOOP - - aspeed+=speed; - - - WHILE (aspeed>100) - - aspeed-=100; - - complete_pos_x=x_resol; - complete_pos_y=y_resol; - - - incr_x=get_distx(ang,100); - x_resol+=incr_x; - incr_y=get_disty(ang,100); - y_resol+=incr_y; - - - IF ((y_resol<=10400 AND incr_y<0) OR (y_resol>=37400 AND incr_y>0)) - speed=speed*7/10; - sound(sound1,80*speed/4000,100); - - ang=fget_angle(x,y,x+incr_x,y-incr_y)+effect_horiz*(pi/96); - - effect_vert=80; - effect_horiz=0; - END - - - IF ((x_resol<=6200 AND incr_x<0) OR (x_resol>=57900 AND incr_x>0)) - speed=speed*7/10; - sound(sound1,30+50*speed/5000,100); - ang=fget_angle(x,y,x-incr_x,y+incr_y)+effect_horiz*(pi/96); - effect_vert=80; - effect_horiz=0; - END - - - x=x_resol/100; - y=y_resol/100; - - - IF (id_collisions=collision(TYPE ball)) - - IF (complete<>id_collisions+id OR who<>id) - - who=id; - complete=id_collisions+id; - - - IF (complete==target+yello) - opposite_hit=TRUE; - END - - - IF (turn) - - IF (id_collisions+id==target+red) - red_hit=TRUE; - END - ELSE - IF (id_collisions+id==yello+red) - red_hit=TRUE; - END - END - - sound(sound0,512,256); - - aspeed+=100; - - - incr_x=get_distx(ang,speed); - incr_y=get_disty(ang,speed); - - - id_collisions.incr_x=get_distx(id_collisions.ang,id_collisions.speed); - id_collisions.incr_y=get_disty(id_collisions.ang,id_collisions.speed); - - - vtotal0=speed+id_collisions.speed; - - - dir_final=get_angle(id_collisions)+effect_horiz*(pi/96); - - - final_speed_x=incr_x+id_collisions.incr_x; - final_speed_y=incr_y+id_collisions.incr_y; - - - - longitude=fget_dist(x,y,x+final_speed_x,y+final_speed_y)*effect_vert/100; - - - effect_vert=80; - effect_horiz=0; - - - - incr_x-=get_distx(dir_final,longitude); - incr_y-=get_disty(dir_final,longitude); - - - ang=fget_angle(x,y,x+incr_x,y+incr_y); - speed=fget_dist(x,y,x+incr_x,y+incr_y); - - - - id_collisions.incr_x+=get_distx(dir_final,longitude); - id_collisions.incr_y+=get_disty(dir_final,longitude); - - - id_collisions.ang=fget_angle(x,y,x+id_collisions.incr_x,y+id_collisions.incr_y); - id_collisions.speed=fget_dist(x,y,x+id_collisions.incr_x,y+id_collisions.incr_y); - - - - vtotal1=speed+id_collisions.speed; - speed=vtotal0*speed/vtotal1; - id_collisions.speed=vtotal0*id_collisions.speed/vtotal1; - - aspeed=speed; - id_collisions.aspeed=id_collisions.speed; - - END - - x_resol=complete_pos_x; - y_resol=complete_pos_y; - - ELSE - - - IF (who==id) - complete=0; - END - - END - - FRAME(0); - - END - - x=x_resol/100; - y=y_resol/100; - - FRAME; - - IF (speed>10) - speed-=10; - IF (effect_vert>80) - effect_vert-=2; - speed+=(effect_vert-80)/10; - END - IF (effect_vert<80) - effect_vert++; - speed-=(80-effect_vert)/2; - END - ELSE - - speed=0; - END - - END -END - - - - - - -PROCESS shade(graph); - -BEGIN - region=1; - z=1; - flags=4; - priority=-1; - LOOP - angle=father.angle; - x=father.x+8; - y=father.y+8; - FRAME; - END -END - - - - - -PROCESS cue(idball); - -PRIVATE - complete_pos_mousepos; - real_x_mousepos; - real_y_mousepos; - force; - distance; -  angle_res; - -BEGIN - shade(7); - - - txt_choice=write(1,114,428,0,choices[choice=0]); - - mouse.x=320; - mouse.y=240; - graph=2; - complete_pos_mousepos=mouse.x; - - x=idball.x; - y=idball.y; - angle=-pi/2; - - id_effects.x=pos_touches_x; - id_effects.y=pos_touches_y; - - LOOP - - IF (choice==0) - - angle-=(complete_pos_mousepos-mouse.x)*(pi/256); - complete_pos_mousepos=mouse.x; - - IF (mouse.x<128) - mouse.x+=320; - complete_pos_mousepos=mouse.x; - END - IF (mouse.x>512) - mouse.x-=320; - complete_pos_mousepos=mouse.x; - END - - IF (mouse.left) - - delete_text(txt_choice); - txt_choice=write(1,114,428,0,choices[1]); - - mouse.x=320; - mouse.y=240; - - REPEAT - FRAME; - UNTIL (NOT mouse.left) - - choice=1; - - real_x_mousepos=mouse.x; - real_y_mousepos=mouse.y; - ELSE - - view(idball,angle+pi); - END - END - - IF (choice==1) - - - id_effects.x=pos_touches_x+(mouse.x-real_x_mousepos)/3; - id_effects.y=pos_touches_y+(mouse.y-real_y_mousepos)/3; - - - distance=fget_dist(pos_touches_x,pos_touches_y,id_effects.x,id_effects.y); - - - IF (distance>22) -  angle_res=fget_angle(pos_touches_x,pos_touches_y,id_effects.x,id_effects.y); - id_effects.x=pos_touches_x+get_distx( angle_res,22); - id_effects.y=pos_touches_y+get_disty( angle_res,22); - END - - - IF (mouse.left) - - - delete_text(txt_choice); - - - txt_choice=write(1,114,428,0,choices[2]); - - - mouse.x=320; - mouse.y=240; - - - REPEAT - FRAME; - UNTIL (NOT mouse.left) - - complete_pos_mousepos=mouse.y; - real_x_mousepos=x; - real_y_mousepos=y; - - choice=2; - - effect_vert=id_effects.y-pos_touches_y; - IF (effect_vert<0) - effect_vert=80-28*-effect_vert/22; - ELSE - effect_vert=80+effect_vert*120/22; - END - effect_horiz=id_effects.x-pos_touches_x; - END - END - - IF (choice==2) - - x=real_x_mousepos+get_distx(angle,mouse.y-240); - y=real_y_mousepos+get_disty(angle,mouse.y-240); - - IF (mouse.y<232) - - delete_text(txt_choice); - - sound(sound1,100,128); - - force=(complete_pos_mousepos-mouse.y)*100; - - IF (force<200) - force=200; - END - IF (force>8000) - force=8000; - END - - idball.speed=force; - - idball.ang=angle+pi; - - complete=0; - signal(id,s_kill); - signal(son,s_kill); - END - - IF (mouse.left) - - delete_text(txt_choice); - txt_choice=write(1,112,428,0,choices[0]); - - x=idball.x; - y=idball.y; - - mouse.x=320; - mouse.y=240; - - REPEAT - FRAME; - UNTIL (NOT mouse.left) - - complete_pos_mousepos=mouse.x; - choice=0; - ELSE - - complete_pos_mousepos=mouse.y; - END - END - FRAME; - END -END - - - - - - -PROCESS view(idball,ang); - -PRIVATE - impact=0; - id_ball2; - -BEGIN - z=2; - - graph=idball.graph; - - x_resol=idball.x_resol; - y_resol=idball.y_resol; - REPEAT - - - incr_x=get_distx(ang,100); - x_resol+=incr_x; - incr_y=get_disty(ang,100); - y_resol+=incr_y; - - - x=x_resol/100; - y=y_resol/100; - - - IF ((y_resol<=10400 AND incr_y<0) OR (y_resol>=37400 AND incr_y>0) OR (x_resol<=6200 AND incr_x<0) OR (x_resol>=57900 AND incr_x>0)) - impact=1; - END - - - WHILE (id_ball2=collision(TYPE ball)) - IF (id_ball2<>idball) - impact=1; - END - END - FRAME(0); - UNTIL (impact) - graph=9; - FRAME; -END - - - - - - -PROCESS effect(); - -BEGIN - - x=pos_touches_x; - y=pos_touches_y; - graph=6; - size=29; - LOOP - FRAME; - END -END - diff --git a/examples/games/speed/Speed.prg b/examples/games/speed/Speed.prg deleted file mode 100644 index 1e1b7af..0000000 --- a/examples/games/speed/Speed.prg +++ /dev/null @@ -1,1137 +0,0 @@ -compiler_options _extended_conditions; -//------------------------------------------------------------------------------ -//TITLE: SPEED_FOR_DUMMIES -//AUTHOR: DANIEL NAVARRO -//DATE: DIV GAMES STUDIO (c) 2000 -//----------------------------------------------------------------------------- - -PROGRAM Speed_for_dummies; - -GLOBAL - car_1[]=8,-12,-11,10,11,12,13,14,-13; - car_2[]=8,-22,-21,20,21,22,23,24,-23; - car_3[]=8,-32,-31,30,31,32,33,34,-33; - car_4[]=8,-42,-41,40,41,42,43,44,-43; - - number; - first_point=44; - - slights; - smotor; - scrash; - scoli; - - channels[4]; - - option; - - first; - second; - third; - fourth; - level=0; - tlevel[]="EASY","NORMAL","HARD"; - - route=0; - troute[]="NORMAL","DESERT"; - - returns=0; - treturns[]="3 ROUNDS","6 ROUNDS","9 ROUNDS"; - treturns2[]="/3","/6","/9"; - - computer_cars_speed; - -LOCAL - speed; - max_speed; - pos; - ret; - counter_ret; - where; - point; - -PRIVATE - car1; - car2; - car3; - car4; - id_objects; - fin_usuario=FALSE; - -BEGIN - - - slights=load_pcm("speed\barco.pcm",0); - smotor=load_pcm("speed\tractor.pcm",1); - scrash=load_pcm("speed\choque.pcm",0); - scoli=load_pcm("speed\metal7.pcm",0); - - set_fps(32,0); - - - load_fpg("speed\speed.fpg"); - load_fpg("speed\pantalla.fpg"); - - - load_fnt("speed\menu.fnt"); - load_fnt("speed\g_numero.fnt"); - load_fnt("speed\g_mayusc.fnt"); - - LOOP - - load_pal("speed\pantalla.fpg"); - fade_on(); - put_screen(1,1); - - - file=1; - graph=5; - flags=0; - x=160; - y=100; - - FROM size=0 TO 95 STEP 5; - FRAME; - END - - menu(); - - - FROM size=100 TO 62 STEP -2; - angle-=pi/10; - x+=5; - y+=3; - FRAME; - END - - graph=6; - size=100; - angle=0; - - minicar(26,128); - - option=0; - - REPEAT - IF (key(_enter) OR key (_space) OR key (_control)) - option=(son.y-110)/18; - END - IF (key(_esc)) - option=4; - END - IF (option==3) - menu_options(); - option=0; - END - FRAME; - UNTIL (option<>0) - - signal(TYPE minicar,s_kill); - signal(TYPE menu,s_kill_tree); - - fade_off(); - timer=0; - IF (option==4) - put_screen(1,2); - graph=0; - - - write (1,120,50,4,"- CREDITS -"); - write (1,120,75,4,"CODER:"); - write (1,120,90,4,"DANIEL NAVARRO"); - write (1,120,110,4,"GRAPHICS:"); - write (1,120,125,4,"RAFAEL BARRASO"); - write (1,120,145,4,"SOUNDS:"); - write (1,120,160,4,"LUIS SUREDA"); - write (1,120,180,4,"DIV GAMES STUDIO"); - fade_on(); - - - REPEAT - FRAME; - UNTIL (scan_code<>0) - - fade_off(); - delete_text(all_text); - exit("Thanks!",0); - FRAME; - END - - - computer_cars_speed=500+level*100; - - IF (route==0) - load_fpg("speed\bosque.fpg"); - load_pal("speed\bosque.fpg"); - number=194; - ELSE - load_fpg("speed\desierto.fpg"); - load_pal("speed\desierto.fpg"); - number=192; - END - channels[0]=sound(smotor,100,256); - channels[1]=sound(smotor,100,256); - - clear_screen(); - - IF (option==1) - channels[2]=sound(smotor,100,256); - channels[3]=sound(smotor,100,150); - define_region(1,0,0,320,64); - start_scroll(0,2,101,0,1,15); - start_mode7(0,2,100,0,0,64); - m7.color=203; - m7.height=128; - m7.focus=224; - - - car1=player(&car_1,0,first_point,_left,_right,_up,_down); - - m7.camera=car1; - - - car2=car(&car_2,first_point+1); - car3=car(&car_3,first_point+2); - car4=car(&car_4,first_point+3); - - - write(3,160,0,1,"POS"); - write_int(2,160,14,1,&car1.pos); - write(3,278,0,1,"ROUND"); - write(2,290,14,1,treturns2[returns]); - write_int(2,254,14,1,&car1.counter_ret); - - ELSE - channels[2]=sound(smotor,100,150); - channels[3]=sound(smotor,100,150); - - define_region(1,0,0,320,16); - define_region(2,0,0,320,99); - define_region(3,0,100,320,16); - define_region(4,0,100,320,99); - start_scroll(0,2,101,0,1,15); - start_scroll(1,2,101,0,3,15); - start_mode7(0,2,100,0,2,16); - start_mode7(1,2,100,0,4,16); - scroll.y0=48; - scroll[1].y0=48; - m7.color=203; - m7.height=78; - m7.focus=224; - m7[1].color=203; - m7[1].height=78; - m7[1].focus=224; - - - car1=player(&car_1,0,first_point,_left,_right,_up,_down); - car2=player(&car_2,1,first_point+1,_r,_t,_q,_a); - m7[0].camera=car1; - m7[1].camera=car2; - - - car3=car(&car_3,first_point+2); - car4=car(&car_4,first_point+3); - - - write(3,140,-4,1,"POS"); - write_int(3,170,-4,1,&car1.pos); - write(3,140,96,1,"POS"); - write_int(3,170,96,1,&car2.pos); - write(3,260,-4,1,"RND"); - write(3,300,-4,1,treturns2[returns]); - write_int(3,285,-4,1,&car1.counter_ret); - write(3,260,96,1,"RND"); - write(3,300,96,1,treturns2[returns]); - write_int(3,285,96,1,&car2.counter_ret); - - END - - - FROM z=0 TO 9; - get_point(2,100,z,&x,&y); - object(200,x,y); - END - - FROM z=10 TO 14; - get_point(2,100,z,&x,&y); - object(201,x,y); - END - FROM z=15 TO 19; - get_point(2,100,z,&x,&y); - object(202,x,y); - END - - minimap(); - fade_on(); - priority=-1; - file=0; - graph=200; - x=160; - y=100; - z=-512; - - REPEAT - - - car1.pos=1; - car2.pos=1; - car3.pos=1; - car4.pos=1; - - IF (car1.where>car2.where) - car2.pos++; - ELSE - car1.pos++; - END - IF (car1.where>car3.where) - car3.pos++; - ELSE - car1.pos++; - END - IF (car1.where>car4.where) - car4.pos++; - ELSE - car1.pos++; - END - - IF (car2.where>car3.where) - car3.pos++; - ELSE - car2.pos++; - END - IF (car2.where>car4.where) - car4.pos++; - ELSE - car2.pos++; - END - IF (car3.where>car4.where) - car4.pos++; - ELSE - car3.pos++; - END - - - - IF (option==1) - IF (car1.pos==1) - IF (car4.max_speedcomputer_cars_speed-64) - car2.max_speed--; - car3.max_speed--; - car4.max_speed--; - END - END - ELSE - IF (car1.pos+car2.pos==3) - IF (car4.max_speedcomputer_cars_speed-64) - car3.max_speed--; - car4.max_speed--; - END - END - IF (car1.pos800 AND timer<900) - graph=0; - signal(id_objects,s_kill); - timer=900; - ELSE - IF (timer>600 AND timer<700) - sound(slights,1000,500); - sound(slights,1000,256); - id_objects.x+=56; - - id_objects.graph++; - flags=4; - timer=700; - ELSE - IF (timer>400 AND timer<500) - sound(slights,200,256); - id_objects.x+=56; - timer=500; - ELSE - IF (timer>200 AND timer<300) - sound(slights,200,256); - id_objects=object2(201,103,100,-600); - timer=300; - END - END - END - END - - - IF (key(_esc)) fin_usuario=TRUE; END - - FRAME; - - UNTIL ((car1.ret==returns*3+4 AND option==1) OR (car1.ret>=returns*3+4 AND car2.ret>=returns*3+4) OR fin_usuario) - - IF (fin_usuario) - fade_off(); - ELSE - fade(0,0,0,1); - WHILE (fading) - FRAME; - END - END - - - unload_fpg(2); - graph=0; - signal(id,s_kill_tree); - signal(id,s_wakeup); - delete_text(all_text); - stop_sound(all_sound); - stop_scroll(0); - stop_scroll(1); - stop_mode7(0); - stop_mode7(1); - - - IF (NOT fin_usuario) - put_screen(0,400); - object2(401,119,163,0); - - - IF (option==1) - IF (car1.pos==1) - object2(402,160,16,0); - ELSE - object2(403,160,16,0); - END - ELSE - IF (car1.pos==1) - object2(404,168,34,0); - ELSE - IF (car2.pos==1) - object2(405,168,34,0); - ELSE - object2(406,160,16,0); - END - END - END - - - write(3,260,76,4,troute[route]); - write(3,260,92,4,tlevel[level]); - write(3,260,108,4,treturns[returns]); - - - select_position(car1.pos,car1.xgraph); - select_position(car2.pos,car2.xgraph); - select_position(car3.pos,car3.xgraph); - select_position(car4.pos,car4.xgraph); - podium_cars(first,120,118); - podium_cars(second,120-80,118+16); - podium_cars(third,120+80,118+32); - object2([fourth+3],280,220,1); - fade_on(); - - - WHILE (NOT key(_esc) AND NOT key(_enter)) - smoke(280+rand(-8,8),210+rand(-8,8)); - FRAME; - END - - - fade_off(); - delete_text(all_text); - signal(id,s_kill_tree); - signal(id,s_wakeup); - ELSE - fin_usuario=FALSE; - END - END -END - - - - - - -PROCESS menu_options(); - -PRIVATE - text[3]; - enter_pressed=FALSE; - -BEGIN - - - text[0]=write(1,0,0,4,tlevel[level]); - text[1]=write(1,0,0,4,troute[route]); - text[2]=write(1,0,0,4,treturns[returns]); - text[3]=write(1,0,0,4,"EXIT"); - - - signal(father,s_freeze); - signal(TYPE minicar,s_sleep); - - file=1; - graph=7; - x=104; - y=-40; - shade_menu(); - WHILE (y<45) - y+=4; - move_text(text[0],104,y-28); - move_text(text[1],104,y-28+18); - move_text(text[2],104,y-28+18*2); - move_text(text[3],104,y-28+18*3); - FRAME; - END - minicar(26,21); - minicar(182,21); - LOOP - IF (key(_enter)) - IF (NOT enter_pressed) - SWITCH ((son.y-3)/18); - CASE 1: - delete_text(text[0]); - level=(level+1)%3; - text[0]=write(1,104,y-28,4,tlevel[level]); - END - CASE 2: - delete_text(text[1]); - route=++route MOD 2; - text[1]=write(1,104,y-28+18,4,troute[route]); - END - CASE 3: - delete_text(text[2]); - returns=++returns MOD 3; - text[2]=write(1,104,y-28+18*2,4,treturns[returns]); - END - DEFAULT: - BREAK; - END - END - enter_pressed=TRUE; - END - ELSE - enter_pressed=FALSE; - END - IF (key(_esc)) - BREAK; - END - FRAME; - END - signal(TYPE minicar,s_sleep); - FROM y=45 TO -40 STEP -4; - move_text(text[0],104,y-28); - move_text(text[1],104,y-28+18); - move_text(text[2],104,y-28+18*2); - move_text(text[3],104,y-28+18*3); - FRAME; - END - - - delete_text(all_text); - signal(father,s_wakeup); - signal(TYPE minicar,s_wakeup); - signal(id,s_kill_tree); -END - - - - - - -PROCESS object2(graph,x,y,z); - -BEGIN - LOOP - FRAME; - END -END - - - - - - -PROCESS podium_cars(xgraph,x,y); - -BEGIN - size=50; - LOOP - angle+=pi/12; - FRAME; - END -END - - - - - - -PROCESS select_position(pos,xgraph); - -BEGIN - SWITCH (pos); - CASE 1: - first=xgraph; - END - CASE 2: - second=xgraph; - END - CASE 3: - third=xgraph; - END - CASE 4: - fourth=xgraph; - END - END -END - - - - - - -PROCESS menu(); - -BEGIN - file=1; - graph=3; - x=104; - y=155; - shade_menu(); - - FROM size=0 TO 95 STEP 5; - FRAME; - END - LOOP - FRAME; - END -END - - - - - - -PROCESS shade_menu(); - -BEGIN - FRAME(0); - file=1; - graph=4; - flags=4; - z=1; - priority=-1; - LOOP - x=father.x; - y=father.y; - size=father.size; - FRAME; - END -END - - - - - - -PROCESS minicar(x,arrives); - -PRIVATE - cont_graphics=0; - -BEGIN - file=1; - y=arrives; - LOOP - IF (key(_down)AND yarrives) - y-=18; - END - cont_graphics++; - cont_graphics=cont_graphics MOD 8; - graph=10+cont_graphics; - FRAME(200); - END -END - - - - - - - - - - -PROCESS player(xgraph,pan,point,left,right,arrives,down); - -PRIVATE - hspeed; - colour; - id2; - counter0; - s_volume; - cont_channels; - -BEGIN - - max_speed=800; - speed=0; - ret=1; - - - get_point(2,100,point,&x,&y); - - - resolution=100; - x=x*resolution; - y=y*resolution; - ctype=c_m7; - - shade(); - ball([xgraph+7]+1,id); - - where=look_where(); - WHILE (timer<700) - FRAME; - END - - LOOP - - change_sound(channels[3-pan],200,abs(speed)+150); - - - where=look_where(); - - IF (key(left)) - scroll[pan].x0-=max_speed/64; - angle+=pi/(51200/max_speed); - END - - IF (key(right)) - scroll[pan].x0+=max_speed/64; - angle-=pi/(51200/max_speed); - END - - - IF (key(arrives)AND speed-max_speed/2) - speed-=max_speed/50; - END - - advance(speed); - - - IF (speed>max_speed/100) - speed-=max_speed/100; - ELSE - IF (speed<-max_speed/100) - speed+=max_speed/100; - ELSE - speed=0; - END - END - - - IF (id2=get_id(TYPE player)) - counter0=get_dist(id2); - IF (counter0<1600) - IF(timer[2]>60) - timer[2]=0; - sound(scoli,500,256); - END - - IF (where0) - speed=speed*9/10; - END - ELSE - IF (id2.speed>0) - id2.speed=id2.speed*9/10; - END - END - IF (rand(0,10)==0) - smoke((x+id2.x)/200,(y+id2.y)/200); - END - END - END - - - cont_channels=0; - WHILE (id2=get_id(TYPE car)) - counter0=get_dist(id2); - s_volume=counter0/16; - IF (s_volume>600) s_volume=600; END - change_sound(channels[cont_channels],600-s_volume,700); - cont_channels++; - IF (counter0<1600) - IF(timer[1]>60) - timer[1]=0; - sound(scoli,500,256); - END - IF (where0) - speed=speed*9/10; - END - ELSE - IF (id2.speed>0) - id2.speed=id2.speed*9/10; - END - END - - IF (rand(0,10)==0) - smoke((x+id2.x)/200,(y+id2.y)/200); - END - END - END - - - colour=map_get_pixel(2,100,x/100,y/100); - - IF (colour<208 AND colour>191) - sound(scrash,1000,256); - change_sound(channels[3-pan],100,150); - - FROM counter0=0 TO 9; - smoke(x/100+rand(-8,8),y/100+rand(-8,8)); - END - - speed=-speed/6; - hspeed=24; - REPEAT - FRAME; - advance(speed); - height+=hspeed; - hspeed-=4; - UNTIL (height<0) - - height=12; - hspeed=12; - REPEAT - - FRAME; - advance(speed); - height+=hspeed; - hspeed-=4; - UNTIL (height<0) - - height=0; - END - FRAME; - END -END - - - - - - -PROCESS shade(); - -BEGIN - ctype=c_m7; - graph=100; - flags=4; - resolution=100; - priority=-1; - z=1; - LOOP - x=father.x; - y=father.y; - FRAME; - END -END - - - - - - -PROCESS smoke(x,y); - -BEGIN - ctype=father.ctype; - graph=101; - flags=4; - REPEAT - IF (ctype==c_m7) - height+=4; - ELSE - y-=2; - END - size-=5; - - FRAME; - UNTIL (size<=0) -END - - - - - - - -PROCESS car(xgraph,point); - -PRIVATE - following_p; - following_p_x; - following_p_y; - -BEGIN - - max_speed=computer_cars_speed; - speed=0; - ret=1; - - get_point(2,100,point,&x,&y); - following_p=point+2; - - resolution=100; - x*=resolution; - y*=resolution; - ctype=c_m7; - - shade(); - ball([xgraph+7]+1,id); - - - get_point(2,100,following_p,&following_p_x,&following_p_y); - following_p_x*=100; - following_p_y*=100; - - where=look_where(); - WHILE (timer<700) - FRAME; - END - - LOOP - - - where=look_where(); - - - angle=fget_angle(x,y,following_p_x,following_p_y); - - advance(speed); - - IF (speedmax_speed) - speed=max_speed; - END - - - IF (fget_dist(x,y,following_p_x,following_p_y)<1600) - following_p+=2; - - IF (rand(0,8)==0) - following_p=(following_p&-2)+rand(0,1); - END - - IF (following_p>=first_point+number) - following_p-=number; - END - - - get_point(2,100,following_p,&following_p_x,&following_p_y); - following_p_x*=100; - following_p_y*=100; - END - FRAME; - END -END - - - - - - -PROCESS object(graph,x,y); - -BEGIN - file=2; - ctype=c_m7; - LOOP - FRAME; - END -END - - - - - - -PROCESS minimap(); - -BEGIN - x=36; - y=36; - file=2; - z=1; - flags=4; - graph=104; - - IF (option==2) - CLONE - y+=100; - END - END - - LOOP - FRAME; - END -END - - - - - - -PROCESS ball(graph,idcar); - -PRIVATE - coord_y=0; - -BEGIN - IF (option==2) - CLONE - coord_y=100; - END - END - - LOOP - x=idcar.x/1600+4; - y=idcar.y/1600+4+coord_y; - FRAME; - END -END - - - - - - -PROCESS look_where(); - -PRIVATE - distance=0; - - min_point=0; - min_where1=0; - min_where2=0; - min_where3=0; - - min_distance1=-1; - min_distance2=-1; - min_distance3=-1; - - -BEGIN - ret=father.ret; - point=(father.point&-2)-10; - - IF (point512) - distance=0; - ELSE - distance=512-distance; - END - - - IF (distance>min_distance1) - min_where3=min_where2; - min_distance3=min_distance2; - min_where2=min_where1; - min_distance2=min_distance1; - min_point=point; - min_where1=point+ret*200; - min_distance1=distance; - ELSE - IF (distance>min_distance2) - min_where3=min_where2; - min_distance3=min_distance2; - min_where2=point+ret*200; - min_distance2=distance; - ELSE - IF (distance>min_distance3) - min_where3=point+ret*200; - min_distance3=distance; - END - - END - END - IF ((point+=2)>=first_point+number) - point-=number; - ret++; - END - END - - - IF (min_point+number/2father.point+number/2) - father.ret--; - END - - - IF (father.ret<1) - father.counter_ret=1; - ELSE - IF (father.ret>returns*3+3) - father.counter_ret=returns*3+3; - ELSE - father.counter_ret=father.ret; - END - END - - - father.point=min_point; - - distance=min_distance1+min_distance2+min_distance3; - - IF (distance<>0) - where=(min_where1*100*min_distance1+min_where2*100*min_distance2+min_where3*100*min_distance3)/distance; - ELSE - where=min_where3; - END - - return(where); - -END -