Video Game Design Carbonade Game Enhancements – Cheat Sheet – Courtesy of Billy Carter How do I add more than one title or beginning screen? OptionsSection: REM DECLARE VARIABLES REM SCREEN DISPLAY – This is your second or option screen. You can have as many as you want. cls 0 load bitmap "images/optionsscreen.bmp" set text size 14 center text 100,300, "PRESS ANY KEY TO PLAY!" REM *** OPTIONS SECTION LOOP do REM CONTROL INPUT if keystate(scancode()) = 1 then gosub MainSection REM REFRESH SCREEN sync loop
How do I add a “you lose” or “you win” screen? EndSection: REM DECLARE VARIABLES REM SCREEN DISPLAY cls 0 if MyScore >= 3000 Load bitmap "images\Win_Screen.bmp" center text 320,200,"YOUR SCORE: "+str$(MyScore) set text size 20 center text 320,180, "PRO!" else Load bitmap "images\Lose_Screen.bmp" center text 320,200,"YOUR SCORE: "+str$(MyScore) set text size 20 center text 320,180, "LOSER!" endif center text 320,240,"PLAY AGAIN [Y/N]?"
How do I add a ceiling to the game? rem Ceiling – You might need to adjust the height and add a collision if needed make object box 160,2000,1000,2000 : position object 160,0,1000,0 : color object 160,rgb(0,255,0) texture object 160,6 : scale object texture 6,50,50
How do I add more collision items to the game? For example, some pillars. REM Add this code to create the Pillars after you create the steps. REM Pillars – Reminder, watch using object numbers that have already been used for p = 1 to 5 make object box p+100,50,1000,50 texture object p+100,3 position object p+100,200,0,(p*150) make object collision box p+100,-25,-500,-25,25,500,25,0 set object collision on p next p Rem Arena Collision Rem After you check for StepsHit, check for Pillers Hit for p = 1 to 5 if object collision(1,p+100) > 0 StepsHit = StepsHit + 1 endif next p
How do I add a floor texture that stretches across the entire floor? REM LOAD IMAGES Load image "images/new_floor.bmp",6 rem create a floor texture – Comment out or delete this code remstart create bitmap 6,32,32 cls rgb(0,155,0) ink rgb(0,145,0),0 box 4,4,12,12 get image 6,0,0,32,32 delete bitmap 6 remend rem Floor make object box 6,2000,1000,2000 : position object 6,0,-500,0 : color object 6,rgb(0,255,0) make object collision box 6,-1000,-500,-1000,1000,500,1000,0 texture object 6,6 : REM scale object texture 6,50,50 – Rem out or delete the scale object code
How can I use models for my fruit rather than spheres? rem Fruits – Of course, you will have to create/find your own fruit models. NumberOfFruits = 20 FruitColor = 0 for t = 1 to NumberOfFruits if FruitColor = 0 r = 255 : g = 0 endif if FruitColor = 1 r = 255 : g = 255 endif if FruitColor = 2 r = 0 : g = 255 endif if FruitColor = 3 r = 255 : g = 125 endif FruitColor = FruitColor + 1 if FruitColor = 4 then FruitColor = 0 if FruitColor = 1 load object "images/apple.x",t + NumberOfFruits scale object t + NumberOfFruits, 2500,2500,2500 color object t + NumberOfFruits,rgb(255,0,0) set object emissive t + NumberOfFruits,rgb(255/3,0,0) else if FruitColor = 2 load object "images/pineapple.x",t + NumberOfFruits scale object t + NumberOfFruits, 2500,2500,2500 color object t + NumberOfFruits,rgb(210,152,12) set object emissive t + NumberOfFruits,rgb(210/3,152/3,12/3) else load object "images/banana.x",t + NumberOfFruits scale object t + NumberOfFruits, 2500,2500,2500 color object t + NumberOfFruits,rgb(239,247,19) set object emissive t + NumberOfFruits,rgb(239/3,247/3,19/3) endif endif rem make object sphere t + NumberOfFruits ,50 rem color object t + NumberOfFruits , rgb(r,g,0) position object t + NumberOfFruits ,Rnd(1900)-950,30,Rnd(1900)-950 rem make object collision box t + NumberOfFruits ,-25,-25,-25,25,25,25,0 next t
How can I delete all of the existing objects, music, sounds, images, etc. before allowing the player to start the game again or go onto a new level? ` *** If the student wants to play again by typing “y”, call the function ClearWorld() if Inkey$()="y" ClearWorld() Endif ` `
*** CLEAR WORLD - ClearWorld *** Remove all existing 3D elements from world – the bold “to” number can change if needed function ClearWorld for x = 1 to 1000 if object exist(x) = 1 then delete object x if matrix exist(x) = 1 then delete matrix x if mesh exist(x) = 1 then delete mesh x if light exist(x) = 1 then delete light x if image exist(x) = 1 then delete image x if sound exist(x) = 1 then delete sound x if music exist(x) = 1 then delete sound x delete static objects next x endfunction
How can I add “bad” or “spoiled” fruit that causes the player to lose points? Also, how can I change the “reward” if a player gets the Super Fruit? For example, more time or power? Rem I am not showing you the exact code, but here is the area where you can add logic. Rem Sphere Collision for t = 1 to NumberOfFruits : rem If I hit one of the little fruits if Object collision(1,t + NumberOfFruits)>0 play sound 4 MyScore = MyScore + 100 : rem How many points each little fruit is worth ` delete object t + NumberOfFruits exclude object on t + NumberOfFruits endIf next t If Object collision(1,100)>0 : rem If I hit the super fruit play sound 5 exclude object on 100 MyScore = MyScore + 1000 : rem How many points the super fruit is worth endIf
How do I add additional levels to the game? OPTION 1: For this cheat, I will explain rather than give the code. At the end of the game when you determine if the player can advance to the next level based on their score, add 1 to a global variable called level. A global variable has a scope (can be used) throughout the entire program. You can then check throughout the game whether level = 2 (or some higher number). If it is, display different textures, different speeds, more steps, more collisions, more fruit, etc. base on the new level throughout the code. You will need to find all of the correct locations in the code to check for the new levels. Remember to delete all existing objects, sounds, music, images, etc. before running a new level. OPTION 2: Some programmers copy all of the code in the MainSection, and paste it as MainSection2 for Level 2 and MainSection3 for Level 3. They then modify the sections with all new objects, sounds, textures, collisions, etc.
How do I add hidden rooms behind the walls? Since this is our very first 3D video game, you might want to add a “fake” wall using the instructions listed earlier for adding more collision items such as the Pillars. Some programmers begin running into many problems by trying to increase the playing area and adding hidden areas behind the existing walls. My advice for this first game is to just create a “fake” wall, but you are welcome to experiment as much as you wish.