YouGroove Posted November 2, 2013 Share Posted November 2, 2013 --This function will be called once when the program starts function App:Start() --Set the application title self.title="luaTest8" --Create a window self.window=Window:Create(self.title) self.window:HideMouse() --Create the graphics context self.context=Context:Create(self.window,0) if self.context==nil then return false end --Create a world self.world=World:Create() --Load a map local mapfile = System:GetProperty("map","Maps/map2.map") if Map:Load(mapfile)==false then return false end return true end --This is our main program loop and will be called continuously until the program ends function App:Loop() if self.window:KeyDown(Key.B) then App.world = World:Create() local mapfile = "Maps/map1.map" Map:Load(mapfile) end if self.window:KeyDown(Key.V) then App.world = World:Create() local mapfile = "Maps/map2.map" Map:Load(mapfile) end --If window has been closed, end the program if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end --Update the app timing Time:Update() --Update the world self.world:Update() --Render the world self.world:Render() --Refresh the screen self.context:Sync() --Returning true tells the main program to keep looping return true end A strange point i didn't got it work first time ? I got map loading that worked one time only, chaning map, always re opened the same ? So in the editor i opened and closed the two maps to check them , and Lua code worked prefectly. Perhaps my PC ? Visual Studio open behind ? Some memory problem ? Anyway that code above works prefectly in Lua Quote Stop toying and make games Link to comment Share on other sites More sharing options...
DudeAwesome Posted January 15, 2014 Share Posted January 15, 2014 is there somewhere a lua tutorial for mapchanges? I think its a bug or something it loads everytime the map I´ve opened in the editor. it just ignore my code. confusing. Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.