Jump to content

Sweetgebus

Developers
  • Posts

    17
  • Joined

  • Last visited

Everything posted by Sweetgebus

  1. I've been struggling with adding a camera to an entity. I get no errors during debug, but when I run the program I get a white screen. Here is the link to the project file.https://drive.google.com/file/d/1YkQFz2wp6OWDCTMAeW3tnALAnKtYxtaE/view?usp=sharing
  2. Self punishment of learning is all. I took your advice though and after a couple of hours of studying and removing functions that were needed for my idea, I got it working.
  3. I'm a little confused on that part. In the doc it just shows angle,move and strafe used. player:SetInput(0,move,strafe)
  4. I've studied the stock fps script and attempted to break it down. In my code snippet I'm fighting just to get my character to jump. I figured I would make a simple platformer where my character, or cube in the case has a constant move speed. Add in gaps and such for you to have to jump over. And as I learn I could add things like speed boosts and such. my script is attached to my character cube.
  5. Let me preface by saying that I have no experience in coding, aside from basics. As I am sure everyone has been at one point, I don't even know how to learn it. Is the docs provided in Leadwerks enough for the non programmer to learn? Do I need to learn Lua outside of leadwerks in order to learn to script within it? I ask this loosely as I know that knowledge is king. If I base my learning purely off the script documentation provided, is that enough to make a game? Example of my current headache regarding set input. function Script:Start() self.camera = Camera:Create() self:UpdateCamera() player = Pivot:Create() end function Script:UpdatePhysics() local jump = ((window:KeyDown(Key.Space) and 1 or 0)) player:SetInput(0,jump) end function Script:UpdateCamera() self.camera:SetRotation(20,90,0) self.camera:SetPosition(self.entity:GetPosition()) self.camera:Move(0,0,-3) end function Script:UpdateWorld() self:UpdateCamera() end Looking at the the documentation, the example code for SetInput shows the player, world, and controls being created via script, rather than using a model and the editor to create the world. I struggle with understanding how to implement it to work with created models. As you guys would probably be able to understand why, the above code is incorrect. I'm sure its simple, but even the most simple task is a nightmare for me. I've wanted to learn to script for over a decade and have made numerous attempts to make sense of it all. The internet is flooded with resources for learning, but that even seems to make it even more overwhelming. I once had a friend who was a coder and for a short time he was great at helping me with trying to learn, but unfortunately he passed away. I appreciate in advance for your responses.
  6. function Script:UpdatePhysics() self.entity:AddForce(0,0,-.5) if window:KeyHit(Key.Space) then self.entity:AddForce(0,10,0,true) end end
  7. is this specific to ultraengine? or is the same for leadwerks 4.6?
  8. Hello, I'm attempting to learn lua script and have been battling what I'm sure is a simple issue. I have my cube"Player" that I have made to be able to jump via key press. With the current logic, I can continue to press the key and the player will never hit the ground. I would like to be able to double jump and then wait for x amount of seconds before doing it again. I was looking into "Wait" but I'm not having luck with it either.
  9. and Nil is just assigning a null value?
  10. This seems to work, I haven't seen the self.speed command before. Not sure how it works. Never the less, I appreciate the help with this. I should be able to manipulate this a bit to get the results I'm looking for, such as not stopping immediately after releasing W.
  11. Now that I know its broken I'm trying to find a work around. I'd like to have an object gain speed over time. Below is what I've been attempting, but haven't been successful. function Script:Start() self.camera = Camera:Create() self:UpdateCamera() end function Script:UpdateCamera() self.camera:SetPosition(self.entity:GetPosition()) self.camera:SetRotation(self.entity:GetRotation()) self.camera:Move(0,3,-4) end function Script:UpdatePhysics() local speed = 0 local gas = false -- Movement / Input if window:KeyDown(Key.W) then gas = true self.entity:Move(0,0,speed) else gas = false while gas == true do speed = speed +1 end end end function Script:UpdateWorld() self:UpdateCamera() end
  12. Thats unfortunate, I've been losing mind for the past few weeks trying to make it work.
  13. documentation is very vague on somethings for sure. I'm unsure how to set up a vehicle model and the docs don't cover it from what I can tell.
  14. does the model have to have wheels? like a hovercraft for example
  15. Hello, I've been dissecting the vehicle script trying to understand how it work. Unfortunately despite weeks of headache I've gotten no where. Below is the Lua script that I pieced together. I do not get any errors, but my logic must be wrong. I can run the program, but nothing happens when the key is pressed. I've very new to scripting and looking for any help I can get. I appreciate it in advance. Script.acceleration=200 --float acceleration function Script:Start() self.vehicle = Vehicle:Create(self.entity) --Create and Update Camera self.camera = Camera:Create() self:UpdateCamera() end function Script:UpdateCamera() --Update Camera Postion and Rotation self.camera:SetPosition(self.entity:GetPosition()) self.camera:SetRotation(self.entity:GetRotation()) self.camera:Move(0,4,-6) end function Script:UpdatePhysics() local groundspeed = self.entity:GetVelocity() groundspeed = groundspeed:xz() groundspeed = groundspeed:Length() local gas = 0 local window = Window:GetCurrent() if window:KeyDown(Key.W) then gas = gas + self.acceleration end self.vehicle:SetGas(gas) end
  16. Thank you, I'll give this a shot.
  17. Hello, new to leadwerks. I've been scratching my head trying to figure out had to addforce to an object in the direction of the camera. I've started out with leadwerks just attempting little things as people usually do. Right now I've got a gokart that I've been able to get moving, but the problem is when it turns, the direction of travel does not. I've utilized the Addforce command but cannot seem to figure out how to make it follow the direction the camera is pointing at the time. I'm scripting lua, and anything help would be appreciated.
×
×
  • Create New...