0 registered members (),
1,490
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: How can you control an entity?
[Re: Thehawk]
#231316
10/13/08 18:07
10/13/08 18:07
|
Joined: Nov 2005
Posts: 66 Spokane, WA, USA
Vonman
Junior Member
|
Junior Member
Joined: Nov 2005
Posts: 66
Spokane, WA, USA
|
I've never tryed to move an entity outside a actual ACTION or FUNCTION but one thing I noticed is that you don't have a LOOP going..
The way your code looks to me now, assuming errorless, if you were to have the left arrow held down right before the entity was created AND held it til after it's creation, it would move 20 points down the y axis only ONE time because the code is not in a WHILE(1) loop.
If I was writing that exact code, it would probably be more like this:
(within your function)
////////////// while(1) // WHILE 1 equalls true (it always does)
{
MY.Y -= key_force.x * 20; wait(1); // put a wait(1) instruction so the loop won't crash. } /////////////////
I noticed you have the following code in there:
///// x = ; // x equals 0 y = ; // y equals 0 z = ; // z equals 0 /////
If you have THAT within a while loop, then in every single frame, x,y, and z will all be set to zero.. If that happens, your object will become stationary, it will not move because every single frame your x,y,z coords are being set to zero.
But with the other code (theoreticaly) the left errow should cause MY.Y to move 20 quants down the Y axis EVERY single frame. If you are running at 200 frames per second, thats 4000 quants for every second you hold the right or left arrow keys (a bit FAST, you might want to try a much lower value).
To sum it up, simply put, you just need to code movement WITHIN a WHILE loop or it won't "REFRESH" every frame.
|
|
|
Re: How can you control an entity?
[Re: Thehawk]
#231390
10/14/08 07:54
10/14/08 07:54
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
Can I create a player in a function?
look up ent_create in the manual. It will create your .mdl file and you can assign an action/function to it.
|
|
|
|