Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   How do I make my character walk? (http://www.alice.org/community/showthread.php?t=6535)

steveguy 05-14-2011 04:51 PM

How do I make my character walk?
 
I want to make code when I press up/forward, down/backward, etc. I want my character to walk while I move my character. What kind of code do I make for this to happen?:confused:

TauTrumpsPi 05-14-2011 05:05 PM

Go to the events, and find the "When a key is pressed" event. Right-Click it, and say change to "While a key is pressed" Then make a method that says move forward (the speed you want it to go), and put it inside the "during" part of the while a key is pressed thing. Repeat this for turning and moving backward as well.

For walking, if your character is made in the people creator, you can use the inborn walk method, messing with the time parameter that shows up when you put it in until it matches the walking time. Put this in a do together block with the movement, and voila, the guy walks and moves at the same time when you press the appropriate key.

steveguy 05-14-2011 05:20 PM

But what if it was a person object NOT from the People Maker?

TauTrumpsPi 05-14-2011 05:30 PM

Then you would need to make your own walk method by, probably by either setting poses and saying set pose back and forth in a realisic way, or just moving the subparts, and then put it in the method in the same way.

jacob waitman 01-29-2012 06:26 PM

Help please
 
i wanna know how do you make the other character walk but they are computer. like you seen in other games.

Mr Kidnapper 01-29-2012 07:16 PM

You want to know how to make an NPC walk? I'll assume you made a walk animation. First things first: The thing you're trying to make is called an AI. Problem is, I don't know what you want to do with it. Well, what do you want to do with it?
Let's assume all you want to do is get the foo to walk in a random direction at random times.
Make three random numbers. One is between 0 and 10, the second is between -.5 and .5, and the third is between 0 and 20. The first one is how long a wait should be done between walks. -.5 and .5 denote which direction it should walk in and by how many degrees, up to 180 degrees left and 180 degrees right. 0 to 20 is how many meters it should walk.
Make an event that executes this method, and by that I mean every 0-10 seconds it makes an NPC turn -180 to 180 degrees and complete the walk animation while moving forward 0-20 meters.

If you want the NPC to chase the camera, you simply have to do the same thing, except make the NPC face the camera.
This is kinda cheap. At some point someone will figure out how to get the NPC to follow a path in order to reach you.


All times are GMT -5. The time now is 08:52 PM.

Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.