Jump to content

Gameplay Tutorial Requests Here


Rick
 Share

Recommended Posts

In my videos I more hope to show ideas on how things can be done than to be a code copying thing. Most of the scripts I have used for the tutorial have been very small and actually I copy from the wiki that collision script on most of them and just make small modifications. It's really about typing things out yourself, experiencing issues and fixing them to learn. I make these tutorials more for learning than to just give out scripts. If I wanted to do that I would just put them on the asset store like I have some other scripts, but these are more about learning and my thought process as I do this for others to see.

  • Upvote 1
Link to comment
Share on other sites

@Rick : it makes sense.

 

@Shirk :

You can do two ways :

- simulate it by just moving camera down for crouching and adjsut collision ; and doding a movement on camera for headbobbing

- animate a character for crouch , headbobbing etc ... and just place camera in front of head (adjust collision height when crouching)

Stop toying and make games

Link to comment
Share on other sites

Ive been trying to figure out the headbobbing in the last few days, but cant get anything to work.

 

http://powayusd.sdcoe.k12.ca.us/teachers/rdohm/Course%20Info/Assignments/Resources/Animation/3D_Anim_Lessons/images/walk.jpg

( or just google images for "walk cycle" )

 

as you can see the head follows a familiar pattern ( stretched sin ) - simply adjust the cameras offset to the ground accordingly as long as the player is moving forward and set it to the normal/high height when they stop.

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

Here is a simple tutorial for a crouch function. I wouldn't say its very good, but at least its a start for someone.

 

Open up FPSPlayer.lua from your assets folder and navigate to the function UpdateWorld around line 230. Right after the end of

if window:KeyHit(Key.E)

add another window.KeyHit for the crouch button (In this case I used C)

if window:KeyDown(Key.C) then
end

 

This checks to see if a key ( the C button) is pressed down within the window. In that add the following code

self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,self.eyeheight * 0.5,0))

 

That sets the current cameras position to half the height of the players eye height.

Just under that add

self.moveSpeed = 2

 

This sets the current move speed to 2 (your speed may differ) so you don't walk as fast as you would standing up.

 

Now to check when the key isn't being pressed so you can continue walking at a normal speed.

if not window:KeyDown(Key.C) then
self.moveSpeed = 4
end

 

That almost looks like the code above, except for the addition of not before the window:KeyDown. This checks to see when the key is not pressed down, and sets the speed back to the normal walking speed.

 

Also, can anyone help me figure out a simple viewbobbing? I dont really know where to begin.

Link to comment
Share on other sites

Got a fairly simple method for saving/loading entity data finished. Will be making a tutorial (with files) tonight. This one is pretty slick if I do say so myself :). There is probably room for improvement but it should work on any platform once the others come about for 3.1, and it's non programmer friendly I think. Leadwerks could help out a little with providing some more info with things, but it works for now.

  • Upvote 2
Link to comment
Share on other sites

np SeaHorse. It was probably my favorite one to do so far since it was a little more involved and interesting!

 

Everyone, please list out anything you'd like to see that isn't already on the front page and is programming related and isn't a huge system that would take hours to explain in a tutorial.

  • Upvote 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...