Author Topic: object moving problem  (Read 2491 times)

0 Members and 1 Guest are viewing this topic.

Offline TomB

object moving problem
« 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.


Paradox: There is three errers in this sentence.

Offline Eigen

Re:object moving problem
« Reply #1 on: August 20, 2003, 06:11:14 AM »
Try using   reset(f42);   after  if (f42){


-Eigen
Artificial Intelligence Competition

Offline TomB

Re:object moving problem
« Reply #2 on: August 20, 2003, 06:45:27 AM »
nope. Didn't work
Paradox: There is three errers in this sentence.

Kon-Tiki

  • Guest
Re:object moving problem
« Reply #3 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-

Offline Joel

Re:object moving problem
« Reply #4 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.
« Last Edit: August 20, 2003, 08:51:04 PM by Joel »

Offline Joel

Re:object moving problem
« Reply #5 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
« Last Edit: August 20, 2003, 08:56:59 PM by Joel »

Offline Andrew_Baker

Re:object moving problem
« Reply #6 on: August 20, 2003, 11:27:50 PM »
newroom block is best if it only needs to be initialized once.
I hope you realize that one day I will devour the Earth.

Offline TomB

Re:object moving problem
« Reply #7 on: August 21, 2003, 01:11:13 AM »
Hey.. wait a sec.. this might be something!

I'm gonna try this
Paradox: There is three errers in this sentence.

Offline TomB

Re:object moving problem
« Reply #8 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).
Paradox: There is three errers in this sentence.

Offline Joel

Re:object moving problem
« Reply #9 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.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.042 seconds with 17 queries.