Jump to content

Rick's Blog

  • entries
    65
  • comments
    96
  • views
    26,351

Character Thingoids


Rick

1,498 views

 Share

I've made and continue to work on 3 objects that you can drag into the editor and get player movement features in about 2 mins. I'll discuss them and their plans here. I prefix them with Pi because that's my sort of namespace so when you place these in your editor's path they won't have the same name as other objects you create/download. Pi is the start of my last name and I'm using it as a brand or sorts also.

 

Character

http://leadwerks.com/werkspace/index.php?app=downloads&showfile=46

 

This is a generic character object. Instead of creating objects for all your characters and placing them in your scene, you just need this object. It creates a character controller and allows you to assign a model. So you can have 100 of these objects in your scene and they can all have different models. This object also accepts some messages for moving the character controller. Right now this is pretty basic but it will get advance and something that should cover most character movement needs.

 

3rd Person Camera

http://leadwerks.com/werkspace/index.php?app=downloads&showfile=45

 

Drag this into your scene and give it a target (anything). Set some offsetting values and this will give you 3rd person camera controls on that target. The future of this is that it'll be able to handle any type of camera setting. 3rd perseon, first person, top/down etc just by setting some keys.

 

Character Keyboard Controls

http://leadwerks.com/werkspace/index.php?app=downloads&showfile=47

 

This will bring life to your Character object. It's meant to work out of the box with the Character object above, but it can work for any object you have as long as you receive some messages that the Keyboard control sends. This allows you to define which keys will move characters.

 

 

 

The part I'm not the most fond of is that the editor uses very specific game scripts. The fps, vehicle, and flythrough. I'm not a fan of how this is setup myself. I think the game script should be very basic and that objects that you drag into your scene are what builds how the game works. So in order for the above 3 objects to work correctly they need the following game script to be running when you run the game. The reason for this is because of keyboard controls and mouse controls. The default game scripts al do something with the keyboard and mouse and if you used them with the above objects they would be fighting for the camera and keyboard controls.

 

require("Scripts/constants/collision_const")
require("Scripts/constants/engine_const")
require("Scripts/LinkedList")
require("Scripts/filesystem")
require("Scripts/math/math")



if fw==nil then --we are not in Editor
       RegisterAbstractPath("")
       Graphics(800,600)		-- need a better way to get screen res
       fw=CreateFramework()
       scene=LoadScene("")		-- need a way to get a scene to load
       scene:SetCollisionType(COLLISION_SCENE)
       TFilter(1)
       AFilter(4)
end

-- set globals
SetGlobalString("mode", "GAME_MODE")
SetGlobalString("quit", "false")

FlushKeys()
FlushMouse()


--main function
while (KeyHit(KEY_ESCAPE) == 0) and (GetGlobalString("quit") == "false") do

       fw:Update()
       fw:Render()
       Flip(0)
end

-- reset values
SetGlobalString("mode", "DESIGN_MODE")
SetGlobalString("quit", "false")

 Share

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   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.

×
×
  • Create New...