Jump to content

epsilonion

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by epsilonion

  1. there we go just added it to the original post..
  2. Hi guys, I made a menu, loaded in a background file for test purposes and assigned a few menu items Start Settings Exit When the program first starts a flag is set to 1 so the menu appears when the program has loaded up. Then it goes into a while loop, while the flag is = 1, then theirs a if block for the menu items. this is where it gets funny.. I have assigned keys to the menu as well as mouse positions, if the mouse is in location and left button is pressed or the T key is pressed then re size the screen to full screen. It works when you press the T key but when you click it, it re-sizes the screen but does not call the menu draw function again to re-size the menu background and text. its wierd because it works if I don't put the menu draw in its own function but then it will not re-size the background or the menu text because it can not be called from the if bock.. I have attached the lua file. App.rar
  3. I am not getting error on the import("Scripts/functions.lua") now but its not doing it really.. this is the contents of the functions.lua I get errors with the self. so i deleted it then errors on the context trying to index self. (nill value) when I deleted the self I got the same but error trying to index contect (nill value) I have googled it etc but not got much help there, I looked at some examples on the site and they work if you are using them in the editor on a asset but I want to call it from the App.lua file to tidy up the coding.. function SplashScreen() splash = Texture:Load("Materials/splash.tex") if startUp >= 1 then self.context:SetColor(0,0,0) self.context:Clear() -- Clear the context self.context:SetColor(1,1,1) self.context:DrawImage(splash,0,0) --Draw the splash screen self.context:Sync(true) -- Sync so it loads the screen Time:Delay(10000) -- Time delay of 10 sec's while the splash is displayed startUp = 0 -- set the startUp flag to 0 so the splash screen does not -- display on the next pass in the loop. end -- end the if statement return startUp --return the startup flag value so the splash screen only runs on startup of the application end
  4. This is basic stuff really and a noob question. Is it possible in lua to place functions in a seperate file and to call them from lua.app What I am wanting to do is put the code for my main menu in a function or method in another file and have it loaded in to be called in the app.lua file. something like require_once ('scripts/functions.lua') then call a function to display a menu menu(); and in the functions file have all my functions like savegame, respawn, inventury etc. I like to do things like this as it keeps everything nice and tidy, also easy to find things when problems arise...
  5. Yup i am new to this. and wow I only placed 15 lights on this level it looks like some of them are duplicated.. I have noticed this on some of the walls when I drag a wall out (create A wall) that 2 have been created so I have to delete one of them.. Thought I was doing something wrong so downloaded unity and tried it on there and it only created one wall so I dont know.. Anyhow, its a good job I backed the scene up before adding lights. I have added the lights again but made sure no duplicates where there, changed the doors from glass to concrete and gave the doors room to move without collision and it run smooth as a babies bottom.. I was wanting to make some higher resolution textures for the walls etc because they look very basic and plain at the moment but I am afraid that this would introduce lag as well..... Thank you for your help guy's its a learning curve since I last programmed over 15 years ago and then I was doing applications such as accounting software, so its a big step.. I have attached the backup file with the lights placed in without the duplicates. Its a test map that I am using to see how things go with the assets I am creating.. meetingroom.rar
  6. Try this http://www.leadwerks.com/werkspace/topic/11576-help-with-start-menu/
  7. I put the files on the workshop and on the website to download as well... Just hope they sticky this.. lol
  8. OK got it.... Menu with mouse position and click on the word Start game or press the S key: function App:Start() --Set menu flag so the menu comes up when game is first loaded self.menuFlag = 1 --Load a texture self.texture = Texture:Load("Images/menuBG.tex") --set the font and text size for the menu local font = Font:Load("Fonts/Arial.ttf",24) self.context:SetFont(font) font:Release() function App:Loop() ---If the escape key is pressed then display the menu if self.window:KeyDown(Key.Escape) or self.menuFlag >= 1 then self.menuFlag = 1 --pause the game?? Time:Pause() --display the texture file for the background image self.context:SetColor(0,0,0) self.context:Clear() self.context:SetColor(1,1,1) --self.context:DrawImage(self.texture,0,0) --reset the context colour to black and clear the contect self.context:SetColor(0,0,0) -- self.context:Clear() --Draw some centered text on the screen local text = "Press S -> Start" local text1 = "Press T -> Settings" local text2 = "Press X -> Exit" --get the font that was set above local font = self.context:GetFont() --get the window height and width to find where you want the text local x = self.window:GetWidth() /3 local y = self.window:GetHeight() /4 --get the text width, height and devide it by 2 tx = x - font:GetTextWidth(text)/2 ty = y - font:GetHeight() self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1) self.context:DrawText(text,tx,ty) self.context:DrawText(text1,tx,ty +40) self.context:DrawText(text2,tx,ty + 80) --reset blend mode self.context:SetBlendMode(Blend.Solid) self.context:Sync(true) --while loop for the menu selection while self.menuFlag >= 1 do -- returns teh x y position of the mouse cursor local mousePos = App.window:GetMousePosition() -- Show the mouse cursor self.window:ShowMouse() if mousePos.x > tx and mousePos.x < (tx + ty / 2) and mousePos.y > ty and mousePos.y < y and self.window:MouseDown(Key.LButton) or self.window:KeyDown(Key.S) then self.menuFlag = 0 self.window:HideMouse() Time:Resume() Time:Update() elseif mousePos.x > tx and mousePos.x < (tx + ty +40 / 2) and mousePos.y > (ty + 40) and mousePos.y < (y + 40) and self.window:MouseDown(Key.LButton) or self.window:KeyDown(Key.T) then --Maximize the window self.window:Maximize() elseif mousePos.x > tx and mousePos.x < (tx + ty +80 / 2) and mousePos.y > (ty + 80) and mousePos.y < (y + 80) and self.window:MouseDown(Key.LButton) or self.window:KeyDown(Key.X) then return false end end end Hope this helps some of you...
  9. Can anyone help with the lag, I have given all doors space around them and its still really slow... I took the rest of the day off to play some game on ultra settings feeling happier now.. I have noticed that my high resolution assets look like the graphics did back in the mid 1990's lol http://youtu.be/BzrlRWXUggI
  10. Thank you... I know I have physics problems I made a life and you can not get crates to go up on it even when child to the lifft...
  11. I was working on my level last night and I noticed a slight fps drop, booted up today and I am getting lots of lag. I have created a small level thats like only 2 small is rooms and a corridor and I am struggling to get over 30 FPS today where as yesterday was above 100 FPS , there are only 16000 polygons so it is not like there are a lot of them any idea's on whats going on? Any ideas would be great meetingroom _02.rar
  12. Tbh I am getting back into programming, it has been 15 years or more since I touched anything and LUA is new to me.. I will post more when I add buttons and mouse etc...
  13. Can this get pinned its getting harder and harder to find stuff with the duplicate questions threads and the search facility not been that good
  14. If it is still saying installed can you verify the integrity, it will redownload any missing files that way.. In steam right click on Leadwerks engine > properties > local files > verify integrity of application cache.. it is worth a go..
  15. I also agree. These would be seen as a big improvement and it would not even take long to implement them, so I don't see why they would not be included
  16. oh I would e interested in this one..
  17. I put it in this topic to limit the amount of duplicate ones you have to troll through before getting an answer, thats if you can find an answer.. and there's no problem with it, it works that's why I posted it here and not made another thread..
  18. Have you tried setting the root gravety to 0 and the player mass to 0? and then use the space (jump key to go up) and the crouch key to go down, I have seen a modified fps script with crouch enabled on it here somewhere... as of 3rd person, I have not tried that yet but I want to and a top down .... Hope this helps...
  19. This is my start up including splash screen: When the game first loads it goes straight into a splash screen with a disclaimer of pre alpha development and a a little advert saying powered by LEADWERKS Game Engine. The menu is just a basic menu for now until I code for the mouse to interact with the menu, you just use the keyboard to select a menu item. It is not finished and gives me basic function of a menu etc, I have to tidy it up but it was 4am when I did this.. Splash Screen: Under the App:start Function --Load a spash screen texture self.splash = Texture:Load("Images/splash.tex") --Set a flag so it does not run the splash screen everytime it loops StartUp = 1 Under the function App:Loop() -- load a splash screen before starting the game -- If the startUp flag is grater or equal to 1 then load the splash screen -- so if it is not greater or equal to 1 then skip past it if startUp >= 1 then self.context:SetColor(0,0,0) self.context:Clear() -- Clear the context self.context:SetColor(1,1,1) self.context:DrawImage(self.splash,0,0) --Draw the splash screen self.context:Sync(true) -- Sync so it loads the screen Time:Delay(10000) -- Time delay of 10 sec's while the splash is displayed -- startUp = 0 -- set the startUp flag to 0 so the splash screen does not -- display on the next pass in the loop. end -- end the if statement Next I put the basic's in for the main menu Basic Menu: function App:Start() --Set menu flag so the menu comes up when game is first loaded self.menuFlag = 1 --Load a texture self.texture = Texture:Load("Images/menuBG.tex") --set the font and text size for the menu local font = Font:Load("Fonts/Arial.ttf",24) self.context:SetFont(font) font:Release() function App:Loop() if self.window:Closed() then return false end --If window has been closed, end the program if self.window:KeyDown(Key.Escape) or self.menuFlag >= 1 then --If the escape key is pressed then display the menu self.menuFlag = 1 Time:Pause() --pause the game self.context:SetColor(0,0,0) --display the texture file for the background image self.context:Clear() self.context:SetColor(1,1,1) self.context:DrawImage(self.texture,0,0) self.context:SetColor(0,0,0) --reset the context colour to black and clear the contect -- self.context:Clear() --Draw some on the screen local text = "Press S -> Start" local text1 = "Press T -> Settings" local text2 = "Press X -> Exit" local font = self.context:GetFont() --get the font that was set above local x = self.window:GetWidth()/4 --get the window height and width local y = self.window:GetHeight()/3 -- and set it up for drawing the text x = x - font:GetTextWidth(text)/2 -- get the text width, height and divide y = y - font:GetHeight()/2 -- it by 2 self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1) self.context:DrawText(text,x,y) self.context:DrawText(text1,x,y +40) self.context:DrawText(text2,x,y + 80) self.context:SetBlendMode(Blend.Solid) -- reset blend -- mode self.context:Sync(true) self.window:ShowMouse() --show mouse while self.menuFlag >= 1 do --while loop for the menu selection if self.window:KeyDown(Key.S) then self.menuFlag = 0 self.window:HideMouse() Time:Resume() Time:Update() end if self.window:KeyDown(Key.T) then self.window:Maximize() --Maximize the window end if self.window:KeyDown(Key.X) then return false end end end
  20. This is what I did in LUA to display a splash screen and pause for 10 seconds. I am trying to implement this in C++ but it is not doing it for some reason. Under the App:start Function --Load a spash screen texture self.splash = Texture:Load("Materials/splash.tex") --Set a flag so it does not run the splash screen everytime it loops StartUp = 1 Under the function App:Loop() --load a splash screen before starting the game -- If the startUp flag is grater or equal to 1 then load the splash screen -- It did not like it if it was just equal to 1 and it bugged out until I put the greater than in if startUp >= 1 then self.context:SetColor(0,0,0) self.context:Clear() -- Clear the context self.context:SetColor(1,1,1) self.context:DrawImage(self.splash,0,0) --Draw the splash screen self.context:Sync(true) -- Sync so it loads the screen Time:Delay(10000) -- Time delay of 10 sec's while the splash is displayed startUp = 0 -- set the startUp flag to 0 so the splash screen does not -- display on the next pass in the loop. end -- end the if statement
  21. Thank you.. I must say I am getting my head around this now... I thought it would take longer since I have not touched any code for over 15 years..
  22. Think I have figured it out.... You would have to use the Window::GetHeight command (gets the outer height of the current window in pixels, and Window::GetWidth gets the width of the current window outer width in pixels, then you would have to drawImage to fit the screen, usefull if you have a settings options for windowed and full screen...
  23. I am wondering if there is a way to re-size a image that is displayed with the drawImage function? Basically the image for the background of my menu should re-size if the screen is windows or in full-screen. the picture should be able to be resized to the resolution of the monitor etc etc.. it just looks more professional if someones got a very high resolution and your in full screen and your background image only covers half the background.. any help would be great.. thank you in advance..
  24. Hi, I am interested in doing a cockpit for a space type game. I will create a model in 3DS max or blender, I am just wondering how to attach it to the first person camera in LUA, would it be a similar process as adding a HUD but not with the Draw command. What I want to do is have clickable objects in the cockpit etc etc as well but that looks like it is the easy part lol... I would use C++ but I am not comfortable enough with it yet so I would prefer to use LUA... any help, I would be thank full for it..
  25. EVE LBS Studio. EVE LBS Studio is a member company of the EVE LBS Group providing quality services to the community. EVE LBS Studio was setup as a sole trading company at the end of 2014 with the insight to becoming a private limited company in the near future. The way we work is that after drawing up a concept of development to include the community as the main source of features and having a prominent input into the development of our software. Our main mission is to put our customers first right from the development process to the final product and beyond, this will create the content in our software that you our community want and enjoy. About me the Managing Director. My Name is Liam Gibbins, I have a HND in computer science and several smaller qualification within the computing industry. After over 15 years of been away from the keyboard I decided to re-ignite my passion for creating software, my past titles have included business applications such as financial packages and contact databases etc to be used in a business setting. My goal is to expand my experience into the gaming industry and to produce titles that I would be interested in playing myself, this is not a money making venture for myself but a re-lighting of a past passion How I started: I was looking around for a games engine to use for learning I tried Unity3D (did not like it), I tried Real Engine 4 (liked this one), then I cam across a cheap engine on sale on the steam store LeadWerks it was 50% off it uses the popular games language LUA (most games use this these days) and it has a C++ upgrade as well... and there's no royalties to pay on any of our future titles with this engine. I played around with LUA for around 24 hours straight and it seems simple enough so I upgraded to the C++ edition because of the better memory usage etc, I have seen a lack of documentation for the C++ upgrade but producing in LUA should be enough for now. The engine should be good enough to use for the first project I have planned but it is a big project and I always have the cry engine to go to if it fails on the LeadWerks engine.
×
×
  • Create New...