Jump to content

WazMeister

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by WazMeister

  1. I see. So how does the move variable hold a bool, a 1 and a 0? Or does lua work in a way that the code is stating - If key down true then =1 and if false then = 0. ??? So once it processes the above for Up and Down , it's basically presenting it as either 1 - 1 = 0 Or 1-0 = 1 Or 0-0 = 0 Or 0-1 = - 1 *4 is then moving player eiher up or down at a speed rate of 4. Just trying to understand syntax really and how a variable can hold all of that and result as a 1 or 0 from keysown 1 and 0 statement.
  2. That example code for keydown. How does that even work? I understand the method of key being pressed is 1 or 0 and doing one key press minus the other will give results of 1 or - 1 and then * it by the speed wanted.. To move left or right. But how does that e, ample work with a variable holding the keydown state... Assuming a 1 or 0.. Then having and 1 and or 0... How does a variable holding 3 diffrent things and a maths function work? What is the keydown resulting in when pushed, I assume either 1 or 0? Then the variable does multiplication?!?! ((window:KeyDown(Key.Up) and 1 or 0) - (window:KeyDown(Key.Down) and 1 or 0))*4
  3. Yes. I think that will work. When I'm. Home tonight, I'll give it a try. Thanks for jumping in to respond. That new command you shared, I'll also check that out tonight. What does it do, should I replace my move commands with that command?
  4. Sorry. Got so far, forgot to post code --Public Values for Editor Script.health = 100--int "Health" --Private Values Script.walkspeed = .02 Script.runspeed = 0.1 --Start script for starting once map loads, set player basic settings function Script:Start() if self.entity:GetMass()== 0 then self.entity:SetMass(10) -- Char Controller default has mass 10. 0 means no physics at all. end self.entity:SetPhysicsMode(Entity.CharacterPhysics) --Setup character controller physics mode self.entity:SetCollisionType(Collision.Character, true) --Create game camera self.camera = Camera:Create() --Update the camera self:UpdateCamera() end --Adjust the camera for top down view on player function Script:UpdateCamera() self.camera:SetRotation(90, 0, 0) self.camera:SetPosition(self.entity:GetPosition()) self.camera:Move(0, 0, -4) end --[[State Machine - Setting State function Script:SetMode(mode) if mode~= self.mode then self.mode = mode if mode=="idle" then --Put player in idle state / animation self.entity:PlayAnimation("Idle", .1, 200) elseif mode=="walk" then self.entity:PlayAnimation("Walk", 0.01, 200) --else --self:SetMode("idle") end end end--]] function Script:UpdateWorld() --Get the game window local window = Window:GetCurrent() --If the 'W' key is pressed move forward and play walk animation if window:KeyDown(Key.W) then self.entity:Move(Vec3(0, 0, -self.walkspeed)) self.entity:PlayAnimation("Walk", .08, 100) elseif window:KeyDown(Key.S) then self.entity:Move(0, 0, .01) self.entity:PlayAnimation("Walkback", .06, 100) else self.entity:PlayAnimation("Idle", 0.7, 500) end if window:KeyDown(Key.A) then self.entity:Turn(0, -3, 0) end if window:KeyDown(Key.D) then self.entity:Turn(0, 3, 0) end if window:KeyDown(Key.Space) and window:KeyDown(Key.W) then self.walkspeed = self.runspeed self.entity:PlayAnimation("Run", .08, 200) else --self.entity:PlayAnimation("Idle", 0.7, 300) self.walkspeed = .02 end --Update the camera each frame self:UpdateCamera() end
  5. Ok. I get away with myself... ADHD for you and the bane of my life! So, the player moves the Trash man (player model) with W, A, S & D. When moving normal, it's the walking animation and speed as shown in video. When the player is pushing W the animation walk triggers, if D is pushed the walk back animation plays. When the Space Bar is pushed, a 'Sprint' mode is enabled, so the animation changes to a sprint one and the player speed increases. As per the video. All working... OK (I think! ha). When the player stands still pushing no keys, but the Space Bar the animation Sprint triggers and the model (player) is running on the spot..... which does not look right or feel right for a game. I want the SPRINT animation to only trigger if space bar is pushed to sprint... and moving forward with W.....If the player stands still, pushing Space should do nothing. Hope that makes sense, think I've confused myself! Down the line, I'd like to add an animation for turning left and right with A & D keys. But only when not moving, little subtle effects like this make game seem more quality. hopefully that makes sense!?!? Sorry if I've confused anyone and been making it harder than what it should be. P.S Really freaking enjoy this Leadwerks stuff! P.P.S - Where in help document does it provide break down on thing like vectors, physics to pick stuff up (i.e do we need to activate a script to do the HL2 pick up physics shown in the FPS example? How do we make certain objects only enable pick up? How do we do trigger load level / new level? Sorry.. off a again 10000 ideas and questions coursing through my neurodiverse brain cells!
  6. Thanks again Josh, I was just about to joke Leadwerks should hire you! You always seem to be the one that respones and has great knowledge. Then realised they already did with Staff under your profile! Do you know what I must change in my code to make the sprint animation only work while player is moving, rather than it playing the animation with player sprinting on spot..I assumed my command of key space and x > greater than 0 would do it, but clearly wrong. Thank you, very kind.
  7. Thank you Josh! Did not realise there was a command like that, can only find Setposition and Getposition in document. Good to know the above, but did not fix my problem. I'm assuming it's because it's not using a typical spd = 3, player.x = spd and then we can check if x is greater than 0 .. i.e his moving. It's using the Move function, so do I need to check for something else? The above, only work if the player is on the grid greater than 0... and holding button down while standing on spot still plays animation.. if I move back to far left.... the sprint does not work at all etc. If I may, another query. I'm not undertanding what the documentation means when it shows multiple syntax for a command. Example MOVE details the below, 2x options for syntax.. I just went with the 2nd one as it makes more basic sense to me. how would the Vec3 Position version work would the x, y ,z go in as argument without commas and wraps it up or something? Syntax void Move(Vec3 position, bool global=false) void Move(number x, number y, number z, bool global=false) Parameters position: the movement to add. x: the X component of the movement to add. y: the Y component of the movement to add. z: the Z component of the movement to add. global: if set to true, the scale of the movement will be in global space, otherwise it will be affected by the entity's own scale.
  8. Also struggling to make it so when space is held down while o the spot, the run animation still triggers. Tried adding another check below, but get error of a "Then" should be added after the >? Think I've got it wrong somewhere obviously! if window:KeyDown(Key.Space) and self.entity:X(>0) then self.walkspeed = self.runspeed self.entity:PlayAnimation("Run", .08, 200) else self.entity:PlayAnimation("Idle", 0.7, 500) self.walkspeed = .02 end --Update the camera each frame self:UpdateCamera()
  9. Hi all, Sorry, back again! So while learning LeadWerks engine I finally got a Top Down View working with animations. It's a little buggy, the idle animation was working fine but now stutters and Sprint has a slight frame jump or something. I'm just wondering if someone would have the time to view my progress and code to check I am on the right track or if it should be done diffrently? Not much help content for Leadwerks anymore so forums are my saving grace (hopefully). I wanted to add an animation of turning / stepping when on the spot and holding A or D (turning) but it did not no work, animation just went about 10000 miles per hour and just odd?!? Short video below, may want to skip to around 45 seconds to see progress and then pause on code at end. Many Thanks!
  10. Is this for leadwerks, can I use this to learn the code and mod it etc?
  11. Shame aggror tutorial videos must been removed.. Not on his YouTube channel anymore.
  12. Found a few good posts and content shared... Think. I'm 4 or so years too late though! 😝. None links to the videos or sites work anymore. Booo shame no archive of it all
  13. Oh blimey that new one looks fat more complex and difficult.. Though amazing. Does it relate to Leadwerks or Ultra though? Seeing alot content for Ultra which confuses me if it's leadwerks or not.
  14. Amazing. Will save this and follow for my own game! Thanks for taking time and effort to share such knowledge.
  15. WazMeister

    A simple prototype

    Amazing player model. Noted your code photo, may have to dissect that and try learn from it to do what I want to (similar third person). Thanks again
  16. Just found this, Amazing quality tutorial. Hoping I find more buried in these Forums and blogs. You're amazing btw. Seen your game shots, amazing
  17. Hi, I recently bought LeadWerks to learn and understanding.. but mainly make games! I've gone through the Leadwerks Documentation tutorials and used the command references to try understand a little bit more. I've arrived here and searched on forums and blogs for various items that I've picked up over years by playing around with game creation but struggling to find any meaty topics that provide any insight or tutorials. I've also done (gulp) youtube search for tutorials on leadwerks and their either really old or not much at all. Following all the documentation and playing around, it's like I've been left in a bit of a hole... which is good at times. Hand holding never really pushes individuals to test, trial by error.. but I feel really stuck, Example, I want my animated model (which is in leadwerks, animations are there. great) to be 3rd person and when I keydown W,A,S,D it will play the certain animation (walk, run if I hold shift), go back to idle state if not moving etc.... I get a top down view, via creating a camera (using the marble tutorial help of creating and moving a camera), I add controls to move my model... using stuff I learnt from the Marble tutorail.... but now nothing for trying to animate... Scouring I identify SetAnimation.. nothing works, I locate PlayAnimation command and get a little something but still not right.. My brain then goes into overdrive... my code needs to be nice... I want a finate state machine to setup player states and animations / movement etc. So i earch for that and don't really find any guides or help.. alot of posts people stating how they use a FSM and how great it is....but no real tips... I search Lua FSM and don't get much help, the code also seems very different from regular Lua coding help to scriping in Leadwerks which threw me off... Sooo sorry, very lond winded post to just get to the point......! Basically, where are all the juicy tutorials, guides and tip content that must of been produced over the years that relates to Leadwerks 4.6 (think that's latest steam version I have). Things like to do following- Third person view Controls Finiate State Machines Animations for player Animations for AI / enemies Terrain production gravity etc... I loacted amazing Character Controller blog Part 1 & 2... thats best content so far. Any advice, very much appreciated. Really enjoying this Leadwerks stuff, I was loving Blitz3D but this took my attentioN!
  18. OH OK.. Now it's starting to make sense. Thank you. So if I removed the update world function from the Coin, for example it might now update it's spin or position etc?
  19. Thanks again Josh, very kind to assist. I'm still not getting it. I understand that on other languages I'd have at end UpdateWorld(), RenderWorld() etc at end of main game loop. The Lua Leadworks tutorials go through add scripts to objects and adding UpdateWorld() script to some of them to update them.... but the API Documents say only add one to the Main game Loop. What I don't understand is. a) Where is main game loop in Lua / Leadwrks Engine to add or edit UpdateWorld? Why has the tutorial not asked us to add a main game loop? b)why does the tutorial add updateworld to each object / script? Or.. is it a case each script tied to an object is like it's own 'programme / code' and it needs it's own UpdateWorld() because it's in it's self a main game loop but for each script added to an object? If that makes sense... or am I looking at this totally wrong?
  20. Thanks Josh. OK. So why does the tutorial ask us to put world update in scripts for specfici objects and not in a main script?
  21. Hello, I bought LeadWerks on steam beginning of week, finally sat down tonight to play around and learn. Reading the help documentation, referencing Script:UpdateWorld() it states it should be called once in Main Game Loop. Running through the marble tutorial, I've already noticed we've called it several times for individual objects. i.e the Ball, now the coin to spin it... So what exactly does it do specific for objects, and why not call it once in a main game loop.. where that may be (as assuming there is not one with scripts added to entities etc?! Many in advance for all your assitance. W
  22. How did you do, looks amazing by the way. So hope I can manage to learn to make games to this quality!
  23. Download link does not work... I've been using Cart Shop for mapping for Blitz3D (yes...retro game making) it has no clipping tool which proves difficult to cut primitives like cylinders etc to make connecting pipes and other nice geometry.....Carve just goes wrong all the time removing primitives. Does this have the features and compatible to export to .b3d? Could a new download link be added please?
×
×
  • Create New...