Community

AGI Programming => Mega Tokyo AGI Archive => Topic started by: TomB on August 20, 2003, 04:52:01 AM

Title: object moving problem
Post by: TomB on August 20, 2003, 04:52:01 AM
Hi,

I have a problem moving objects. When I want to move an object (using either move.obj (mov.obj.v) or set.dir commands), it only moves one pixel, and then stops.  ???

here's my code:


animate.obj(alien2);
load.view(8);
set.view(alien2,8);
position(alien2,15,80);
release.loop(alien2);
stop.cycling(alien2);
draw(alien2);

if (f42){
  v28 = 3;
  set.dir(alien2,v28);
  normal.motion(alien2);
  print("Then, another man walks on the stage.");
  reset(f42);
}


Cycling objects won't work either!
What am I doing wrong here??

Pleeeese help me. I've been working on this problem for almost a week now!

PS Moving the ego by changing v6 works fine.
Title: Re:object moving problem
Post by: Eigen on August 20, 2003, 06:11:14 AM
Try using   reset(f42);   after  if (f42){


-Eigen
Title: Re:object moving problem
Post by: TomB on August 20, 2003, 06:45:27 AM
nope. Didn't work
Title: Re:object moving problem
Post by: Kon-Tiki on August 20, 2003, 04:37:35 PM
If you didn't say cycling objects didn't work, I'd say you missed start.cycling(alien2) (or start.cycle, always confuse them) I still think that's the problem though.

Maybe a little help: does it display the print-message?

-Kon-Tiki-
Title: Re:object moving problem
Post by: Joel on August 20, 2003, 08:50:33 PM
Is this code:

Code: [Select]
animate.obj(alien2);
load.view(8);
set.view(alien2,8);
position(alien2,15,80);
release.loop(alien2);
stop.cycling(alien2);
draw(alien2);

inside of your new room section? If not, then it will get executed every interpreter cycle and the position of your character will continually be reset to (15, 80). If you do this:

Code: [Select]
if (new_room)
{
    // other room initialization stuff here
    animate.obj(alien2);
    load.view(8);
    set.view(alien2,8);
    position(alien2,15,80);
    release.loop(alien2);
    // stop.cycling doesn't belong here -- your
    // character will move without looping, giving
    // an "ice skating" movement
//    stop.cycling(alien2);
    draw(alien2);
}

if (f42){
  v28 = 3;
  set.dir(alien2,v28);
  normal.motion(alien2);
  print("Then, another man walks on the stage.");
  reset(f42);
}

it should work.
Title: Re:object moving problem
Post by: Joel on August 20, 2003, 08:53:28 PM
actually, if I understand the intent of your code correctly, then the stop.cycling command is fine there, but inside of your if (f42) block, you should also issue the start.cycling command.

one more correction -- that code doesn't necessarily have to be in the new room block, but it should be inside an if statement of some sort so that it doesn't keep getting executed
Title: Re:object moving problem
Post by: Andrew_Baker on August 20, 2003, 11:27:50 PM
newroom block is best if it only needs to be initialized once.
Title: Re:object moving problem
Post by: TomB on August 21, 2003, 01:11:13 AM
Hey.. wait a sec.. this might be something!

I'm gonna try this
Title: Re:object moving problem
Post by: TomB on August 21, 2003, 01:18:07 AM
Whohoo! It worked! :)

Thanks guys.

He was iceskating BTW, but I soon fixed that (forgot to start the cycling).
Title: Re:object moving problem
Post by: Joel on August 21, 2003, 06:05:47 PM
newroom block is best if it only needs to be initialized once.

I made the point because it sounded like this was a timed entrance, in which case putting the initialization in the new room block may not have been desirable. Of course, I guess as long as the draw command is not issued the rest could still be in the new room block.