Quote:

But I think I did it right.




OBJECTION!

OHNO STRIKE BACK!

Judge agrees!

Okay, thats enough.

Let's have a look at your function that moves the entities. It's called "move_car".

Whoa!

(Okay, I'm really done now)

Specifically, this part:

Code:

if(switch == 1)
{
c_move(truck_ent,truck_speed,nullvector,IGNORE_YOU|GLIDE);
}



Here, we have some things that I don`t like. And all in this short piece of code!

At first, it only moves as long as "switch" is equal to one. You likely have a variable called "switch" SOMEWHERE in your code - if its not set to 1, it won't work at all. Maybe you should make this a flag? Like this.

Code:

if(my.flag1 == on) {
... REST GOES HERE



This has some advantages: For example, you can now stop the cars individually and not just all at once. You can also combine that with your general swtich-variable, then you can stop them all at once (set switch to something other than 1) or just stop them by switching their flag1 to off.

Note though that you have to put the line "my.flag1 = on;" into the action of your trucks now.

Okay, I guess I won't be done for quite a while

So then. What else don't I like?

If you look at the c_move-instruction, you can clearly see that it only moves "truck_ent". That is a pointer. Pointer a magical beings full of HATE AND PAIN. Actually, they're quite neat. They point to things: In this case, they point to whatever entity we want to move. Who is it, then?

OH NO!

See? There is no line like "truck_ent=me;" anywhere in your code. Well, maybe it is in your fade_in-function, but I doubt that. So there.

Due to the fact that you call this from the entities' action, it would make sense to move the entity that originally called that function. We can simply use "me" here. No, not me, the pointer, of course!

Code:

c_move(me,truck_speed,nullvector,IGNORE_YOU|GLIDE);



The last thing that I don't like is "truck_speed". We expect a vector here, which states how to move that entity (you know... forward? Upwards?). You have to define it somewhere! Again, you could make this a skill of an entity or you could be superlazy and do this

Code:

c_move(truck_ent,vector(25*time_step,0,0),nullvector,IGNORE_YOU|GLIDE);



It's much, much, much better this way, because now there is a "time_Step" in there. This guarantees the same behaviour on different machines - otherwise, your truck would move faster on faster computers!


Thats all that I saw, but I haven't looked that long at your code, so maybe I missed something. Tell me if it works!

It is also true that I mainly did this post because I finally could use that Objection-site.


Also:

Quote:

...numbers of cars every 10 seconds:



Quote:

sleep(5);




OBJECTION!

Last edited by Error014; 06/11/07 16:42.

Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!