Hi!
I have a COG here that moves a crate across a conveyor belt. But, things happen!
The ghost (create) has 6 frames (5 if you don't count the first one), and when I look in the hole where they are supposed to come out, the first crate is stuck on frame 2 (1), and the other crates come normally, but aren't random!
And when the crates come to turnframe0 (wich is 2 (1)) they won't slow down to speed 1. But they will slow down at turnframe1 (which is 4 (3)). Help!
/Edward
------------------
I'm addicted to the following things:
Computers
Coca Cola/Jolt Cola
JK
I have a COG here that moves a crate across a conveyor belt. But, things happen!
Code:
# Crates on Conveyor belt
#
# By Edward
symbols
message startup
message arrived
message removed
thing create
thing c local
flex speed
int numframes
int turnframe0=0
int turnframe1=0
int turnframe2=0
int turnframe3=0
int usedtf
template crate0
template crate1
template crate2
template crate3
template crate4
template crate5
template crate6
template crate7
template crate8
template crate9
template crate10
template crate11
template crate12
template crate13
template crate14
template crate15
int numcrates
int i local
int frame=0 local
end
#
code
startup:
sleep(1);
c=CreateThing(crate0[rand()*numcrates],create);
CaptureThing(c);
MoveToFrame(c,1,speed);
frame=0;
return;
arrived:
If(GetSenderRef()!=c) return;
frame=frame+1;
if(usedtf!=0)
{
for(i=0; i<usedtf; i=i+1)
{
If(GetCurFrame(c)==turnframe0)
{
MoveToFrame(c,turnframe0+1,1);
}
else
{
MoveToFrame(c,frame+1,speed);
}
}
}
if(GetCurFrame(c)==numframes)
{
DestroyThing(c);
c=CreateThing(crate0[rand()*numcrates],create);
CaptureThing(c);
MoveToFrame(c,1,speed);
frame=0;
}
return;
removed:
If(GetSenderRef()!=c) return;
c=CreateThing(crate0[rand()*numcrates],create);
CaptureThing(c);
MoveToFrame(c,1,speed);
frame=0;
return;
end
The ghost (create) has 6 frames (5 if you don't count the first one), and when I look in the hole where they are supposed to come out, the first crate is stuck on frame 2 (1), and the other crates come normally, but aren't random!
And when the crates come to turnframe0 (wich is 2 (1)) they won't slow down to speed 1. But they will slow down at turnframe1 (which is 4 (3)). Help!
/Edward
------------------
I'm addicted to the following things:
Computers
Coca Cola/Jolt Cola
JK