Game modes
Blitz3D Forums/Blitz3D Beginners Area/Game modes
| ||
So, i'm not very great on functions... what i'm attempting to do is essentially (make my own engine?) i assume that's the correct way to refer to it. If i want to write out code to tell blitz -(Title_Screen)-(Main_Game)-(Ingame_Menu)-(Combat_Mode)- etc.. etc... the way i assumed it would be run is something to the effect of.. Function Title_Screen() (Title info here) End Function Function Main_Game() (Main code line here) End Function But for some reason or another I cant seem to get these to correlate, I don't entirely know what I'm doing wrong... or not doing is probably the case, but I believe I lack the code writing knowledge to relate these two to one another, any advice would be helpful |
| ||
normaly you have a main loop: [bbcode]Repeat Cls ; Do all the things Flip Until KeyHit(1)[/bbcode] If you wish to change several screen, you would use a "flag" variable: [bbcode]Global ScreenMode% Repeat Cls If ScreenMode=0 Title_Screen() ElseIf ScreenMode=1 Main_Game() Endif Flip Until KeyHit(1)[/bbcode] Now you can switch between the screens only by changing the variable ScreenMode% anywhere in your program. f.e. time dependend: Global ScreenMode%, TitelTime% Repeat Cls If ScreenMode=0 Title_Screen() ElseIf ScreenMode=1 Main_Game() Endif Flip Until KeyHit(1) Function Title_Screen() ;(Title info here) If TitelTime=0 TitelTime=Millisecs()+3*1000 ElseIf TitelTime < Millisecs() ScreenMode=1 Endif End Function |
| ||
Thanks Midimaster, that definately helped some writers block I was having, still experiencing a few bugs, but at least I have a heading now. Does this look right? The title screen text seems to be having difficulties saying it doesn't exist. |
| ||
Cool I got it, the text was hanging out in global, and the function codes was blocking the text from reaching the titlescreen varibles. |
| ||
Well, now I cant seem to figure out how to tell it to go from the title screen to the main loop :( |
| ||
Some heavy bugs found: 1. you have to put the loading of images and sounds outside of your Repeat/Until-loop!!! With the current position inside the function they are inside the loop and will be loaded 60 times a second! GLOBAL logo=LoadImage("Red-Sky-Texture.jpg") GLOBAL music=LoadSound("FFX.mp3") Repeat .... Until Function Title_Screen() ..... End Function 2. Never use a second FLIP or a second CLS in your programm. Title_Screen will return to main loop and will do these commands here. 3. Do not stop your code with a DELAY 3000, but with another Flag like for SCREE_MODE: GLOBAL logo=LoadImage("Red-Sky-Texture.jpg") CONST SCREEN_TITLE%=0, SCREEN_GAME%=1 Global ScreenMode%, TitleTime%, TextTime% Repeat Cls Select ScreenMode Case SCREEN_TITLE Title_Screen() Case SCREEN_GAME Main_Game() End Select Flip Until Function Title_Screen() DrawBlock logo,GraphicsWidth()/2,GraphicsHeight()/2 If TitleTime=0 TitleTime=MilliSecs()+3*1000 ElseIf TitleTime < MilliSecs() ScreenMode=SCREEN_TEXT EndIf End Function Function Text_Screen() DrawBlock logo,GraphicsWidth()/2,GraphicsHeight()/2 Color 0,0,0 SetFont fntCambria75 Text 700,100,"Relics of Cilldrea",0,1 SetFont fntCambria Text 20,350,"New Game",0,1 ..... If TitleTime=0 If music LoopSound music mc=PlaySound(music) EndIf ..... TitleTime=MilliSecs()+3*1000 ElseIf TitleTime < MilliSecs() FreeFont Cambria FreeFont Cambria75 ..... ScreenMode=SCREEN_TEXT EndIf End Function If you have to do something only once in a function the best places is the "If TitleTime=0" at the start or the "ElseIf TitleTime < MilliSecs()" if you need it at the end 4. Use more CONST instead of 1 or 2 to name game states: CONST SCREEN_TITLE%=0, SCREEN_GAME%=1 ..... Repeat Cls Select ScreenMode Case SCREEN_TITLE ..... Use YES or NO, or ON and OFF, TRUE or FALSE and so on... |
| ||
Appreciate the advice :) by no means am I very experienced. Would you be able to tell me how to integrate a mousepick into the title screen? For example, if I wanted to click one of the screen options and have it start the game loop or terminate the program? I had considered using a drawblock+mousepick but I cant seem to figure out how to phrase the code line correctly :( Last edited 2012 |
| ||
There's a slight change you can make to better handle this state logic. You should not change critical game-state variables like that "ScreenMode" inside the functions themselves, else it'll be hell to debug things when you have more complex code. Rather have the functions return a state value that represents what that function thinks is the best state for the program to change to (even if it means to continue in the same state). Pseudo code illustrating this: [bbcode] Const STATE_QUIT% = -1 Const STATE_INTRO% = 1 Const STATE_MENU% = 2 ;Main menu screen, with the basic "start, load, options" etc. combo. Const STATE_MENU_OPTIONS% = 3 ;Separate screen for changing game options. Const STATE_MENU_LOADSAVE% = 4 ;Separate screen for loading\saving a game. Const STATE_START_GAME% = 5 Const STATE_PLAY_GAME% = 6 Const STATE_RETURN_TO_MENU% = 7 Local FPSTimer% = CreateTimer(60) While Not LeaveApp() WaitTimer(FPSTimer) ;Don't be afraid to use a huge-ass Select block. You'll only need a ;single one of these for the entire game. Select CurrentState Case STATE_INTRO CurrentState = HandleIntro() Case STATE_MENU CurrentState = HandleMenu() Case STATE_MENU_OPTIONS CurrentState = HandleMenuOptions() Case STATE_MENU_LOADSAVE CurrentState = HandleMenuLoadSave() Case STATE_START_GAME CurrentState = HandleStartGame() Case STATE_PLAY_GAME CurrentState = HandlePlayGame() Case STATE_RETURN_TO_MENU CurrentState = HandleReturnMenu() Case STATE_QUIT End End Select Wend End ;Sample of one of these functions: Function HandleMenu%() Local tempState% = STATE_MENU ;Set a default value first. ;Logic code to update\poll relevant data for the menu, such as mouse clicks etc. ;[...] ;Let's say the user presses a menu button to start the game. You should ;evolve the program's state to the game preparation state: If [...] Then tempState = STATE_START_GAME ;If the user chose to go to the "options screen", change to the ;appropriate state as well: If [...] Then tempState = STATE_MENU_OPTIONS ;Function calls to render relevant graphics for this state, the menu, ;such as an animated background, special effects, the mouse icon etc. RenderMenu() ;At the end you return whatever state this function saw fit to proceed ;to, based on its logic tests. ;If all tests at the logic section above failed, this function will return the ;default STATE_MENU and so it will keep on executing for the next ;frame. This will keep going until this function returns a state that calls ;for a different screen. Return tempState End Function [/bbcode] It may be a bit intimidating at first, but this is actually a very clean method, and with this you can handle lots and lots of states and make your game\application very dynamic. You can easily handle several unique screens or game modes with this, and more especially have 'state transition screens' that can enrich your visuals: instead of snapping from the menu directly to gameplay, you can fade the screen out, show some animation and then fade in to gameplay if you implement this as a small STATE_MENU_TO_GAME state to be added to that Select block. EDIT: That Select is only necessary because B3D doesn't support function pointers or OOP, else you could have a single line invoking something like CurrentState = CurrentState.Update() and be done with it. Last edited 2012 |
| ||
Thanks guys, I really appreciate it |
| ||
responding to mouse clicks is not very complicated... 1. FIRST WAY (easy to understand) In the main loop you store the current mouse state in global variables. Inside the menu screen you fix an area and when the variables are inside it, the reaction is to change of the flag ScreenMode: Graphics 800,600 SetBuffer BackBuffer() Global MouseButton%, MouseXPos%, MouseYPos% Const PRESSED%=1 Global ScreenMode%, TitleTime%, TextTime% Const SCREEN_TITLE%=0, SCREEN_GAME%=1, SCREEN_OPTIONS%=3 Repeat Cls MouseButton=MouseHit(1) MouseXPos=MouseX() MouseYPos=MouseY() If ScreenMode=0 Title_Screen() ElseIf ScreenMode=1 Main_Game() EndIf Flip Until KeyHit(1) Function Title_Screen() ; simulate one button at 100,400 with size 170,20 If MouseButton=PRESSED DebugLog "click" If MouseXPos>100 And MouseXPos<270 If MouseYPos>400 And MouseYPos<420 DebugLog "inside" ScreenMode=1 EndIf EndIf EndIf Color 255,255,255 Text 105,405,"S T A R T G A M E " Color 255,0,0 Rect 100,400,170,20,0 End Function Function Main_Game() Color 0,255,0 Rect 0,0,800,600 End Function In this code you have inverstigated, that the text you want to malke clickable has the screen coordinates 100/400 to 270/420. (The red box only simulates the borders for demonstation). First you ask, whether the mouse is clicked. Then check the mouse x value then the y value. If all three conditions are valid, change the ScreenMode. If you need this for multiple buttons you can do it multiple: Function Title_Screen() ; simulate one button at 100,400 with size 170,20 If MouseButton=PRESSED DebugLog "click" ;button 1 If MouseXPos>100 And MouseXPos<270 If MouseYPos>400 And MouseYPos<420 DebugLog "inside 1" ;ScreenMode=1 EndIf EndIf ;button 2 If MouseXPos>300 And MouseXPos<400 If MouseYPos>300 And MouseYPos<420 DebugLog "inside 2" ;ScreenMode=3 EndIf EndIf EndIf ; button 1 Color 255,255,255 Text 105,405,"S T A R T G A M E " Color 255,0,0 Rect 100,400,170,20,0 ; button 2 Color 255,255,255 Text 305,305,"G A M E O P T I O N S" Color 255,0,0 Rect 300,300,200,20,0 End Function 2. WAY MORE ELEGANT, (but more complicated) but with a lot of button this creates a lot of code difficult to keep the overview. so you could outsource it in a function: Graphics 800,600 SetBuffer BackBuffer() Global MouseButton%, MouseXPos%, MouseYPos% Const PRESSED%=1 Global ScreenMode%, TitleTime%, TextTime% Const SCREEN_TITLE%=0, SCREEN_GAME%=1, SCREEN_OPTIONS%=3 Repeat Cls MouseButton=MouseHit(1) MouseXPos=MouseX() MouseYPos=MouseY() If ScreenMode=0 Title_Screen() ElseIf ScreenMode=1 Main_Game() EndIf Flip Until KeyHit(1) Function Title_Screen() If Button ("S T A R T G A M E ",100,400) ScreenMode=SCREEN_GAME ElseIf Button ("G A M E O P T I O N S",300,200) ScreenMode=SCREEN_OPTIONS EndIf End Function Function Button%(ButtonText$,X%,Y%) ; find out the dimensions of the text Local Width%=StringWidth(ButtonText)+10 Local Height%=StringHeight(ButtonText)+10 ;draw the button Color 255,255,255 Text X+5,Y+5,ButtonText Color 255,0,0 Rect X,Y,Width, Height,0 ;check the mouse If MouseButton=PRESSED If MouseXPos>X And MouseXPos<X+Width If MouseYPos>Y And MouseYPos<Y+Height DebugLog "inside" ; result:mouse inside Return True EndIf EndIf EndIf ; result: not inside Return False End Function Function Main_Game() Color 0,255,0 Rect 0,0,800,600 End Function and this is not the end, you could use types to shrink and organize the code more and more..... |
| ||
Outstanding! Thank you! |
| ||
Kryzon I attempted to use some of your code, but for some reason blitz doesn't recognize some of your keywords such as CurrentState, and LeaveApp.. do you have a particular outside program that influences these words? Could be that I'm using Blitz3d and BlitzMax and 3d have different terminologies XD |
| ||
Hi. Well, that being pseudo-code, it requires you to just take the "gist" of it and implement it in your own personal way. You don't necessarily need to reproduce it completely, you can just take whatever parts you find interesting and build something of your own. I meant to use CurrentState as a global Integer variable for storing the current state. [bbcode]Global CurrentState%[/bbcode] It would be analogous to your 'ScreenMode' there, although 'CurrentState' is a more intuitive name in my opinion. As for LeaveApp(), you can interpret it as a function to check game quitting events. Instead of simply stating "While Not KeyHit(1)" as you normally would, you can assign more complex code to this condition by calling a function. [bbcode]Function LeaveApp%() ;Returns 1 or 0. If (CurrentState = STATE_QUIT) Or KeyDown(1) Or (KeyDown(56) And KeyDown(62)) Then Return True Return False End Function [/bbcode] (so this function not only checks for the standard ESC presses, but also checks if the current state is 'quit', or if the user is pressing the ALT+F4 combo.) Last edited 2012 |
| ||
Yeah, I apologize, still having difficulties grasping functions themselves... I actually finally interpreted what you intended a few minutes ago, I've been so buried in code writing that I hadn't got to posting my apologies yet. |
| ||
Midimaster, So, I've been toying around with your advice briefly and I encountered a couple hiccups on my end. 1) I cant seem to get my title graphic to show for some reason. 2) When the code was adapted to include my own information, pressing a button does not work. It seems to only work when I attempt to copy/paste and run in its own separate program. Would you be able to tell me where I'm F***** up? lol Nearly forgot, when I try to run the function of my current "main game" content blitz returns with the error -functions must be in the main program- or w/e.... Last edited 2012 |
| ||
PRESSING A BUTTON the problem seems to be in the button function. There is a nice DEBUG message in the code... DebugLog "inside" ..., but as you see in the debugger it will never happen.... so, what to do? enter more debug messages to surround the bug: Function Button%(ButtonText$,X%,Y%) ; find out the dimensions of the text Local Width%=StringWidth(ButtonText)+10 Local Height%=StringHeight(ButtonText)+10 ;draw the button Color 255,255,255 Text X+5,Y+5,ButtonText Color 255,0,0 Rect X,Y,Width, Height,0 ;check the mouse DebugLog "Button" If MouseButton=PRESSED DebugLog "Button pressed" If MouseXPos>X And MouseXPos<X+Width DebugLog "Button pressed Mouse X" If MouseYPos>Y And MouseYPos<Y+Height DebugLog "Button pressed Mouse X Mouse Y" ; result:mouse inside Return True EndIf EndIf EndIf ; result: not inside Return False End Function now run the code and check, what (not) happen.... The result is, that already the debug message "Button pressed" dos not appear. So the problem must be in the code line: If MouseButton=PRESSED Either MouseButton or PRESSED have a problem. So let us check MouseButton... Where is it else? ah, here: Global MouseBuntton% ..... Repeat Cls MouseButton=MouseHit(1) ....... Because of the typo MouseBuntton the variable never got GLOBAL and so its value never reached the function CONCLUSION I recommend to you: use the debugger. It is a powerful help. During development I have a lot of DEBUG statements in my code. If I think the code works I comment them out, but do not clear them. Maybe (=often) you will need them again... YOUR TITLE GRAPHIC Your title graphic is in the function Title_Cosmetics()? You nowhere call the function! Move the graphic to ;title________________________________________________ Function Title_Screen() DrawBlock logo,GraphicsWidth()/2,GraphicsHeight()/2 Text 700,100,"Relics of Cilldrea",0,0 Text 1050,750,"Beta 0.1",0,0 Text 650,700,"2012 Eightball Entertainment",0,0 If Button ("N E W G A M E",20,350) ScreenMode=SCREEN_GAME ElseIf Button ("C O N T I U E",20,400) ScreenMode=SCREEN_CONTINUE ElseIf Button ("M U L T I P L A Y E R", 20,450) ScreenMode=SCREEN_MULTIPLAYER ElseIf Button ("O P T I O N S",20,500) ScreenMode=SCREEN_OPTIONS ElseIf Button ("Q U I T",20,550) ScreenMode=SCREEN_QUIT EndIf End Function MAIN GAME PROBLEM I cannot say anything without seeing the complete code... Last edited 2012 |
| ||
Newb< lmao dude you're my hero, but now it seems that the image is centered in the lower right of the screen, and music is only played when program has ended. I have linked my complete code above, as well, this was updated: |
| ||
Funny, I changed to worked like a charm |
| ||
So using your code, and some teeth gritting time in paint, I've managed to create an in game menu, it's still a work in progress, but in the end I think it'll turn out ok. Eventually I'd like to see character portraits/health bars etc... / possibly a game map,location/currency counter/time... just to start. Problem I'm having right now is figuring out how to make each individual menu option to do something different. EDIT: Apologies, massive fail on the image link Last edited 2012 |
| ||
Figured it out, thanks again Midimaster, your help has been invaluable |
| ||
GRAPHICS3D? are you planning to add 3d functionality? Because if not, there is no reason for adding light and camera, etc... IMAGE CENTERED? If you have an image that is as big as your graphic screen, there is non need to center it: DrawBlock gamemenu,0,0 That is exactly what you are doing here: DrawBlock logo,GraphicsWidth()/1200,GraphicsHeight()/800GraphisWidth/1200=0!!! The reason why this... DrawBlock logo,GraphicsWidth()/2,GraphicsHeight()/2...is not centered correct, is because the drawing origin of images is default at its top left corner. If you want to move the "Zero-point" towards the middle of an image, you can use this command: MidHandle gamemenu PLAYSOUND() The command is only necessary one time to start the music. So if you place it inside the REPEAT/UNTIL the code will (re-)start it over and over again. Effect:You just can hear it in the end, when nothing "disturbes" the playing any more. If you want to hear it during the menu, plce it here: .... Const SCREEN_OPTIONS%=4,SCREEN_QUIT%=5 LoopSound music mc=PlaySound(music) ;Screen Mode__________________________________________ Repeat Cls MouseButton=MouseHit(1) .... and... first LoadSound(), then LoopSound(), then PlaySound()!!! MENU OPTIONS As you set the variable ScreenMode correct, you only have to add IF-commands in the main loop to branch to the corresponding functions. I demonstrated this already with the branch MainGame() in a former post #10. If ScreenMode=SCREEN_GAME Game_Menu() ElseIf ScreenMode=SCREEN_CONTINUE MainGame() ElseIf ScreenMode=SCREEN_MULTIPLAYER ;?? ElseIf ScreenMode=SCREEN_OPTIONS GameOptions() ElseIfScreenMode=SCREEN_QUIT End EndIf Of course this must be followed by the corresponding functions: Function Game_Menu() ; your code already exists End Function GameOptions() Color 255,0,0 Rect 400,400,100,100 If Button ("BACK",20,550) ScreenMode=SCREEN_GAME Endif EndIf End Function MainGame() Color 0,0,255 Rect MouseX(),400,100,100 If Button ("BACK",20,550) ScreenMode=SCREEN_GAME Endif End ; and so on: Function WhatEver() ..... If Button ("BACK",20,550) ScreenMode=SCREEN_GAME Endif End Inside this functions you write whatever you want to display. The functions will be called 60 times a second after each FLIP Often you have to problem to do something only once when the function is called first. In this case you add a flag FIRSTTIME% Global FirstTime% Const OFF%=0, ON%=1 .... Function MainGame() If FirstTime=OFF Then FirstTime=ON PlayMusic InGameSong ; do more thing only once Endif Color 0,0,255 Rect MouseX(),400,100,100 If Button ("BACK",20,550) ScreenMode=SCREEN_GAME FirstTime=OFF Endif End |
| ||
Hmm, this may explain a small bug I've encountered, if the program is left up and running long enough, it encounters a text error, saying the text doesn't exist, would this have to do with it being loaded 60 times per second? I've also created a loading screen background, and obtained some archive code to generate a loading bar when transferring between screen modes. I haven't attempted to implement it yet, simply because I feel that with my current understanding that this screen would just create more for the game to load and would be no benefit to the program. Is this how all loading screens are supposed to work? How would I go about inserting this between the title menu and the main game functions while it's loading? |
| ||
Nearly forgot... As for the graphics mode, I didn't feel like calling graphics twice, as my game is 3D I just called it once, and it seems to work well enough, the title screen loads into the game itself very well, it just takes roughly 30 seconds to transfer between the two, which is why I'd like to put this loading bar into effect. EDIT: As for centering the image, I thought the code required that I typed it that way. Changed it to thanks a million Last edited 2012 |
| ||
normaly it is not necessary to add a progress bar, because loading is so fast nowadays. It is also not the code you should focus on at such an early moment.... I would suggest to focus on the game itself! There is so much to do... If you heartly want to do something like this, load one picture of your logo, show it LoadImage() DrawImage() Flip ;now loadAnything... ... ;Main Loop Repeat Cls ..... Flip Until KeyHit() then continue with loading other things. The picture will keep on the screen |
| ||
This is a game I have been developing for 11 years, I just started working code since this October, story/items/abilities/equipment so on and so forth are very indepth. The reason I would like to impliment this is like i said, it takes roughly 30 seconds for the program to go from loading screen-to the main game. Initially I didn't think it was going to work but patience is a virtue. for the past two months I have been building cities/the main world/and rooms in 3d modeling programs and currently have a few of them in place. It is quite enjoyable watching all my work finally coming to life. The problem is that I'm doing this 100% by myself, so it is very time consuming, putting my imagination into blitz/sketchup/blender. There are two GIANT hurdles in my future that I barely understand animation, attempting to animate a blank...white...3d model of a character to control in the game is incredibly difficult, i can get a model in there, but i cant get it to animate. second... creating my combat system---(fighting/equipment/stats/abilities/and items) are all beyond my current level of understanding on coding. Not to seem like a mooch on the forums, but in the future expect many....posts here in the beginners section. |
| ||
ok.. 30 seconds is a lot! this could make a progress bar necessary. At the other hand... perhaps you are able to load not all datas in the first moment... I would suggest to load a company logo with some music. And you could switch the progress bar after each file loaded. You can use your ccLoadingBar() function, but remove the SETBUFFER() and FLIP commands and integrate it as a function in the existing main loop: |
| ||
Gonna give that a shot, and see what happens, Thanks again |
| ||
I integrated this code, but for some reason I cant place it in between the title screen and the main game |
| ||
the order is set by the value of ScreenMode%. In my sample ScreenMode% is set on 10 at the beginning. So it starts with the loading... Inside te loading screen a counter goes from 1 to 25 to simulate the 25 files to be loaded. In the last step ScreenMode% will be set to 0 to switch to the title screen. If you want to place it between the title screen and the game screen you need to set the ScreenMode% on 0 at the beginning. Game starts with the title screen. Now the menu... If Button ("S T A R T G A M E ",100,400) ... must set the ScreenMode% to 10. Effect: The loading screen starts, when user want to start the game. Now the inside counter runs from 0 to 25. In step 25 ScreenMode% must be set to 1. Effect: game screen will be displayed. What problem do you have? What effect do you see? Cannot help without code... |
| ||
that could possibly be the problem, I set the screen mode for the loading screen to 6. I didn't realize there was a purpose for it being 10? I continue to assume that since it's the last one in the sequence that it should work properly, however I will attempt to try it this way. |
| ||
of course it does not matter if you use 6 or 10! And if you send a sort of my code in your answer instead of your (problematic) code, I cannot help you... What is the code, you are using at the moment? |
| ||
I refer you to comment #26 my friend |
| ||
sorry, i do not understand... you wrote: I integrated this code, ... where to? is it difficult to send me the current state of your version? |
| ||
I didn't realize you wanted the whole thing, |
| ||
I apologize if my responses are limited on this topic, I have shifted gears on integrating a 3d character model, traveling around as a red sphere is becoming taxing on my creative nature |
| ||
thank you for the code. I will have a look on it and call back... for 3d model questions I would open a new thread... ***EDIT**** your code: 1. If you want to start with the LoadingScreen you should set ScreenMode% to 10 before the REPEAT command 2. Loading sound before REPEAT is OK, because you already will hear a music during loading the rest. 3. instead of my "MY COMPANY" you should draw your company logo there 4. Where I wrote ";Enemy=LoadImage..." of course you should add all your loading stuff, each stuff in one CASE statement, remove the DELAYs. I only entered it to simulate time consumption. 5. You also should move all FONT loading in the LoadingScreen(). The function Title_Screen() is the wrong place. 6. Also move all loading of *.3ds" files into the LoadingScreen() function. Do not forget to make all the mesh variables GLOBAL, if you need them later again 7. Count all loading stuff and change the variable MaxLoads#=25 to the correct number. 8. Your are creating two cameras. This is wrong! 9. Divide the Main_Game() in two functions: one who does the stuff, which has to be done only once. And a second function which only contains the WHILE/WEND stuff. But without WHILE/WEND! Call the first function Main_Prepair() and at its end switch ScreenMode% again. Global SCREEN_RUN%=11 ..... Repeat Cls MouseButton=MouseHit(1) MouseXPos=MouseX() MouseYPos=MouseY() If ScreenMode=0 Title_Screen() ElseIf ScreenMode=1 Game_Prepair() ElseIf ScreenMode=SCREEN_RUN Main_Game() ElseIf ScreenMode=10 LoadingScreen() EndIf Flip Until ScreenMode=5 Or KeyHit(1) ..... Function Main_Prepair() camera=CreateCamera() CameraRange camera,1,10000 CameraClsColor camera,0,0,255 ...... ...... ScaleEntity AA,0.5,0.5,0.5 EntityColor AA,255,0,0 EntityType AA,type_scenery ;Cilldrea Castle ScreenMode=SCREEN_RUN% End Function Function MainGame() If KeyDown(32)=True Then MoveEntity sphere,1,0,0 If KeyDown(30)=True Then MoveEntity sphere,-1,0,0 If KeyDown(31)=True Then MoveEntity sphere,0,0,-0.05 ..... ..... EndIf Next UpdateWorld RenderWorld Text 10,10, "x: " + EntityX(sphere) +" y: " + EntityY(sphere) + " z: " + EntityZ(sphere) End Function You need no another FLIP in this Main_Game()!!! Last edited 2012 Last edited 2012 |
| ||
I will give this some thought, I didn't change those couple things while testing it just to see if it would do something, didn't do anything, but thanks for the tips. |