Moving and animating an object (SOLVED)

Started by Darkmaster400, Sat 24/06/2006 14:04:05

Previous topic - Next topic

Darkmaster400

Hello guys,

Okay Ima go straigh to line here,

I have View1 and View2 here, okay.. And in this case I will use View2..
So I have 1 frame in Loop 0 (Down), and more frames in Loop 1 (Left), Okay..
Now I want Loop 0 to be enabled and moving towards a X and Y point.
I done that now, okay.. Then it reaches the x and y point, so I want it to
jump to Loop 1, WHEN it has reached the x and y point..

I tried:

*object*.SetView(2, 0);
*object*.Visible = true;
*object*.Move(155, 180, 2);
*object*.Visible = false;
*object2*.Visible = true;

With the code above, I wanted the object in Loop 0 to move to a postion then
it will disappear and the object in Loop 1 would be visible, so it LOOKS LIKE
the object are being replaced at a position, but as you can see, it
will disappear and the other object (object2) will appear..

Something is wrong now with this code..

I simply want object1 to go to a position then start animating object2
Games Process :
---------------------
Mick Fitz Episode 1 :

Story : |----------| 0 %
Graphics : |----------| 10 %
Sound/Music : |---------| 10 %
Scripting : |----------| 0 %

----------------------------------------

Ashen

#1
Firstly, I think this should be in Beginners Tech, as it seems like a pretty basic question. Although, since you haven't actually said what the problem IS, it's hard to tell.

The most obvious thing is, there's nothing to make the object animate. Unlike Characters, Objects don't automatically animate just because they're moving, so you'll need to include an Object.Animate command in there somewhere. You'll also want to look at the eBlock parameter for Object.Move, as that'll make it wait for the movement to finish, before the next bit (object 1 off, object 2 on).
(Unless you've got it in another bit of code somewhere, you might also want to set object 2's view & loop - although I don't see why you're using 2 objects instead of just animating object 1 with the second loop.)

In short - reading the manual would've helped here.
I know what you're thinking ... Don't think that.

Darkmaster400

Yes, the objects are in same view..
But your right, I COULD try to use 1 Loop, but if I do it will animate at the same time
it moves, and then I want it to be Frame 1 in the Loop until it reaches the position..
And when it reached the position, THEN I want it to start animate.. tried everything here :-\
Games Process :
---------------------
Mick Fitz Episode 1 :

Story : |----------| 0 %
Graphics : |----------| 10 %
Sound/Music : |---------| 10 %
Scripting : |----------| 0 %

----------------------------------------

Ashen

Read those manual entries (if you didn't notice, Object.Animate and Object.Move in my last post link to the on-line version of the manual). Specifically note that:
  • Object.Animate can specify which loop to use - you can animate an object using loop 0, then animate the same object with loop 1
  • The eBlock parameter stops the next script line from running until the current one completes - meaning you can animate, then move, then animate again. Like I said in my last post.

    *object*.SetView(2, 0);
    *object*.Visible = true;
    *object*.Animate(0, 3, eOnce, eBlock); // Do the first part of the animation.
    // You might need another '*object*.SetView' here, to lock the right Frame
    *object*.Move(155, 180, 2,eBlock); // Move Object
    *object*.Animate(1, 3, eBlock); // Do the second part of the animation, with the same Object

    I'm assuming where you've got *object* here, there's the Object's actual script name in the proper code. Also, that you've got a walkable area for the object to move on.
I know what you're thinking ... Don't think that.

Darkmaster400

#4
Thanks for the great code, but isnt:

*object*.animate(0, 3, eOnce, eBlock);

pretty useless, since I am only using 1 frame in the loop??

EDIT: GREAT!! I got it to work the way I wanted now! Thanks..
Games Process :
---------------------
Mick Fitz Episode 1 :

Story : |----------| 0 %
Graphics : |----------| 10 %
Sound/Music : |---------| 10 %
Scripting : |----------| 0 %

----------------------------------------

Ashen

Ah yes, sorry - misunderstood. I thought you wanted animation-movement-animation (since you're talking about two loops). If you don't want it to animate before moving then just remove the line you quoted. Or set the object to the graphic you want in the editor, and use object.SetView immediately before the animation, since a one frame loop is a bit pointless in itself.
I know what you're thinking ... Don't think that.

Darkmaster400

hah okay, well it works great now anyhow with the code u posted..
But im experience something I think is related to the sprites and not the codes..

I got Loop0 to fall now but when it changes over to Loop1 it is moving away a little
from where Loop0 landed.. Hmm,  :-\..

Thanks anyhow Ashen ;D
Games Process :
---------------------
Mick Fitz Episode 1 :

Story : |----------| 0 %
Graphics : |----------| 10 %
Sound/Music : |---------| 10 %
Scripting : |----------| 0 %

----------------------------------------

SMF spam blocked by CleanTalk