Jump to content

Rick

Members
  • Posts

    7,936
  • Joined

  • Last visited

Everything posted by Rick

  1. I offer a 1 on 1 Lua for Leadwerks training. The link to schedule one is in my sig below. $10 and hour and I go through this kind of stuff. It's meant for beginners or programmers new to Lua and want a quick lesson to catch up fast.
  2. I think allowing the LE commands for I/O and that one for returning the right folder by platform to write too and only allowing those file types would be a great addition for saved games!
  3. Does the file write limitation include the LE File I/O commands or can those be used still for game save type data?
  4. Look at outlast and you'll get a better idea of what we are going for. We have this look right now and it's working well. This isn't a FPS game.
  5. One, I guess hacky but it'll work, way to do this is to make triggers in certain areas that will turn on/off emitters. For example if you walked up stairs to this floor, you could have a trigger that would disable that emitter below and enable the one above. You can control this via the flowgraph easy enough.
  6. Rick

    Lua and Gui's

    Not sure what you are asking. You would put this callback table inside your GUI library and expose the SetCallback() function from your GUI library as well for us to set what script function we want to assign as the callback. Then when you need to call it from your GUI library you would do that last line of code. That's all you'd really need to do. All the other stuff in there was just an example to show that.
  7. Rick

    Lua and Gui's

    Go to http://www.lua.org/cgi-bin/demo and copy paste the below in and you'll see that it calls the Script level function as the callback. -- this table will store our callback script object and script function callback = {} callback.obj = nil callback.func = nil -- function like yours to set callback function SetCallback(obj, func) callback.obj = obj callback.func = func end -- simulate how the scripts work Script = {} function Script:Create() local obj = {} -- this copies the object Script function to this local table local k,v for k,v in pairs(Script) do obj[k] = v end return obj end function Script:Start() SetCallback(self, self.MyCallback) end -- user defined script level function function Script:MyCallback() print("Inside MyCallback") end -- create an instance of this script and call it's Start(). LE does this behind the scene for us but this is just to show testScript = Script:Create() testScript:Start() -- this is how you would call the callback from your library. callback.func(callback.obj)
  8. Bring it into a modeling package and export it rotated correctly. I used to do this in UU3D. I'm sure there are free options.
  9. Rick

    Lua and Gui's

    I would think the following should be in UpdateWorld() instead of PostRender(): self.windowmanager.Process() When storing the callback you might want to consider allowing for script level functions instead of global functions. In your example windowcallback() is global to the entire game which means if you use a GUI in another script and have the same function you are overwriting the function based on which script was read in first. The way to do this is to first allow your SetCallback() to accept 2 parameters. The first one would be the script object and the second the script function. So usage would look like: SetCallback(self, windowcallback). Then we would define our callback inside these entity scripts like: function Script:windowcallback() end In your library just store the obj and function in variables. When it's time to call you can call it like: func(obj) This calls the script function and passes the script object. In Lua this is what gives you the 'self' variable (it's hidden and done behind the scenes).
  10. I remember an issue with the weapon also. It's just how it was coded changing levels wasn't considered. If I remember correctly there is a change that needs to be done to that script to avoid this error. A bug report might not do much, but keep debugging. I'll see if I can remember what I did to fix that error.
  11. So are you saying you want to set materials on shapes? You don't generally do that as shapes are generally just used for collision which is invisible. Curious as to why are you wanting to do this?
  12. So inside FPSPlayer.lua in the Script:Release() function comment out the releasing of the listener and flashlight and it should work for you. All I did was place System:Print() functions between all those releases and ran to get the error and then checked the output tab in the script editor to see what printed. This told me how far it was getting. Commenting those out allowed the world to fully be cleared and load the next world. However there might be a leak and issue with those. I'm not 100% sure at this time why the listener and flashlight fail to release.
  13. Comment out the creation of the new world in ShouldSwitch() and try that. You clear the world which means you clear all the entities in it so no need to recreate it as it'll be blank after clearing. Can you specifically where it crashes?
  14. Can you post your App.lua file for us to see. Also, does it look like it free's the old level and loads the new level? What do you have in the new level?
  15. When it comes to App, you can just do App:Function(). If you have an instance of an entity (like in the Collision() function, then you have to use entity.script:Function()).
  16. I don't think you want to release the world anymore. Calling :Clear() on it I believe is the way Josh recommended doing it. The reason your script is failing is because when you update Leadwerks it overwrites you App.lua file to it's original state, which means that function doesn't exist anymore. Not all is lost, LE should have made a backup of your App.lua that you had before. Look in the directory App.lua is in and you should see a backup of it. Rename that back and all should be good. Yes, it sucks that LE does this.
  17. @gamecreator Don't we just select the root node and add them that way? That doesn't require coding in Lua to apply them.
  18. http://www.leadwerks.com/werkspace/files/download/420-random-output-scripts/ Place a pivot in your scene and attach this script to it (pick how many different sounds you want from 2-4 (if you need more you can see how to alter the script). Place pivots in your scene for each sound and attach the already available noise.lua script in your Scripts directory to them and assign your sounds. http://www.leadwerks.com/werkspace/files/file/419-scene-loaded/ Place another pivot in your scene and attach this script to it. Open the flowgraph editor and drag from the scene tab all these entities into the flowgraph. Drag the startup node output to the random node input. Then drag each random output to 1 noise play input. You are saying that when your scene starts call this random node which will randomly pick one of it's outputs to fire. That output is connected to the noise input to play the sound. If you want this to repeat then on each noise node finished output you can link it back to the random node input. This is the beauty of the flowgraph. Being able to piece together more complex functionality from basic components instead of having to rewrite everything specifically for your game! If you want a delay between sounds then place a pivot in the scene and attach http://www.leadwerks.com/werkspace/files/file/412-le3-timer-node/ . Fill out it's properties. Drag it into the flowgraph and link all noise nodes outputs to this timer nodes start and enable and then link it's tick output back to the random node input AND to itself disable to stop the timer. If you need help I can create the flowgraph tonight and show you the picture of how it should look. All of this functionality with 0 programming from your side
  19. @shadmar why do you have "extern Effect *TheEffect;" in that code?
  20. Send your project to Josh for him to test out.
  21. @Dude I guess I wouldn't call that a true 2D game. Also, I didn't say no. I showed him how he can do it with textures which can be thought of as sprites in a 2D specific game library. You showed him another way with Orthographic (although have you tried that in Leadwerks? I found it harder myself). Neither is thinking inside or outside the box. They are just 2 different ways to do the task.
  22. With true 2D games you are just drawing textures/images to the screen. You wouldn't use 90% of what Leadwerks has to offer (which is fine if that's what you want). You would only be using Textures to load your images and draw them to the screen. You would have no lights, no models, etc. You wouldn't need a scene. Just create a world & camera and you should be good to start drawing 2D stuff. At this point you make your own game objects and handle the 2D stuff yourself. For example if you have a hero character you could make a Hero class that takes a list of textures that you will swap which one to draw for animation. If you want a tilemap then you'll need a texture file for each tile and draw them yourself in your own Map class or whatever you want to call it. Leadwerks isn't really a 2D engine but you can do a 2D game with it. It just isn't going to do anything out of the box that most 2D engines do. For example no direct support for tilesets or charsets. Unless you get into OpenGL yourself to do those each tile/frame will be it's own image that you load with Texture:Load() and you animate yourself by flipping through textures at a given rate.
  23. There seems to be 2 files named the exact same thing in the download button. Which should I pick?
  24. Wasn't trying to give you a reason that was good enough for you, was just giving you the reason It only confuses things to have it here with no way to currently purchase it. It has been pushed aside for LE 3.
  25. You can also change the world size by clicking on the root element in the scene tab and changing the property on the bottom right.
×
×
  • Create New...