Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi! Im trying some code, but this is didn't work, im not a programmer. Im just need to make behavior to play animation "Walk" when i press WASD, and play "Stand" when i release WASD. This piece of code is didnt work, im just trying to test on "W" key. behavior_LegsAnimation = function() Also, i was try to use built-in "Object controlled by keyboard" with 0 speed, just for animation controll, but this didnt work with A-D keys. Any help? |
||||
|
I can't understand what do you mean by not working with A-D keys..... I am assuming that you are trying to say that movement speed '0' isn't affecting the keys A and D , for your information let me tell you A-D in inbuilt behavior are used for rotation of the player not for movement so changing move speed to '0', will not affect it. You will also need to set rotation speed to '0'. For the piece of code.... I can't say anything untill seeing the whole behavior , because there might be problem in the properties tag or anything else...... Hope you figured it out already hy yourself or you can use inbuilt behavior... Personally i don't think that creating a behavior for this to work with animation is really make sense... Because if your player has diffrent animation name you have to rename them everytime... Instead i will go with the internal behavior of switch animation... Hope that works.. |
||||
|
I mean, in "Object controlled by keyboard", when i press W or S it play animation "Walk", but if i press A or D it not... I need script or behabior, what can just play animation like in "Object controlled by keyboard" but with WASD keys |
||||
|
You can simply add behavior when a key pressed do something and change animation of the object... And when a key left up change back to idle... If that helps |
||||
|
I was trying this, but if i press W and A both - it will stop playing animation or make it wrong... |
||||
|
Try using variables for animation... And when keypressed check the variable and execute animation... |
||||
|
if you still want to use behavior script... something like this might work for you probably... /* |
||||
|
Oh! Thanks tim12345! You save my life, again :) |
|