Character Left/Right Script - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13) +--- Thread: Character Left/Right Script (/showthread.php?tid=1443) |
Character Left/Right Script - Jacob__mybb_import1 - 03-20-2011 If you make a left, right, and center version of a skin, you can use this script to make all players of your game use it. The direction they are facing will change appropriately as they move. [lua]left ="http://buildism.net/asset/file/152.png" center = "http://buildism.net/game/defaultskin.png" right = "http://buildism.net/asset/file/153.png" character = nil function propertyChanged(name, value) if name == "Velocity" then if value.x == 0 then character.Skin = center elseif value.x < 0 then character.Skin = left elseif value.x > 0 then character.Skin = right end end end function childAdded(newcharacter) if newcharacter:isA("Character") and game.Players:getChild(newcharacter.Name) ~= nil then character = newcharacter character.Skin = center local c = character.Body:getChild("Controller") if c ~= nil and c:isA("VelocityController") then link(c.PropertyChanged, propertyChanged) end end end link(game.World.ChildAdded, childAdded)[/lua] I'm thinking about officially adding this to the game. I would put space in the skin file for 2 extra heads, so you can do the effect with just one file, and it will work at any game. Opinions? RE: Character Left/Right Script - Fat_Sacks - 03-21-2011 Yes, please add it. And add when a player is idle, the face just turns forward. RE: Character Left/Right Script - Xray - 03-24-2011 Add it This is your Top Priority :3 RE: Character Left/Right Script - Qwertygiy - 03-24-2011 I know I'm not the only one who's thought about adding this -- yes PLEASE add it into the game. HOWEVER... What about all our old skins? If you make the change, please make sure that our old skins don't go completely out of date -- either that, or make it so that we can 're-upload' and change the description of skins. By the way, there is a PropertyChanged event here? Awsome. Anyway, it's been a few days since this thread 'died' -- please put this in when you add stable welds at the lastest! |