Object / Character animations (SOLVED)

Started by Bhup, Mon 20/12/2004 18:04:47

Previous topic - Next topic

Bhup

Please somebody help.  I have looked in the forum for an answer to this question but cannot find one without running up a huge bill,despite this I have looked really hard for a solution in the forum, so please don't attack me...the answer to my problem might be staring me in the face but I just don't see it. 

I am trying to create a cutscene or an animated sequence of frames in response to the main character clicking an inventory item on a hotspot.  In the interaction editor of hotspot 0 I use a conditional event:

conditional-if inventory item was used(9):

I then run a child script:

            SetObjectView(0,3);
            AnimateObject (0,0,40,1);

but when I run it, instead of the animation (frames), running from the bottom left of the screen they start halfway up the middle of the screen.  I have tried looking for a "setPosition" of some kind but cannot find anything which moves the frames I want to animate, to the bottom left of the screen.

Please somebody help I would be most greatful.
bhup

Radiant


Doctor Oakroot

I think the function you want is SetObjectPosition.

I had this same problem when I started an object with one view and then changed to another view with different dimensions. An easy way to find the right position is change the image of the object in the editor, move it to the right position and note the coordinates.

Ishmael

Can't you just put the object on the right position in the editor?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Bhup

Thanks all for replying so soon   :)

I am allready aware of SetObjectPosition but this does not work.  It refers to an object not the frames in "view3" that I am trying to animate.  I don't see that each frame in "view3" are objects.  Or are they? If so how do I know what object number they are.  Am I wrong or right??

Ishmael

Is the problem here that the animation plays in the wrong position on the screen? If it is, you could try just moving the object 0 in that room down the y axis?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Bhup

Dear Ishmael, :)

I don't see how moving Object 0 would help.  It is part of the background and I have made it a hotspot in the Room Editor under 'Areas'. Sorry I am unable to show example of pictures.  p.s. In the Objects section of the Room Editor all the inventory items are referred to as 'objects'. I hope I am not confusing the issue by refering to the hotspot as 'object 0' as it is the only hotspot in the Areas of the Room Editor.  Could you possibly confirm this.

Alos the character is supposed to throw a rope with a sword attached to it, to a lifebuoy as soon as the user clicks on the lifebuoy with the sword attached to the rope.  The otherside of the rope is attached automatcally to the boat. I want to animate the sequence where the character is seen to be throwing the rope.  (Sorry for sounding so laborious).  But when I do this the bottom left of each animation frame starts around the middle of the screen.  Could you please help again?  :P
Bhup

Radiant

Ah, here's the thing.
First you set the object to a position.
Then you assign a view to the object.
Then you animate the object.
A view never animates on its own. It must be a character or object that uses it.

Ishmael

Yes, in the Objects section under the Room Editor just click the "New Object" button, click on the room view to place it, set it's view to the view you've made for the animation, and tick the box to hide the object.

Then, when you want the animation to play, put ShowObject(0); before the AnimateObject command in case the object doesn't show up automatically when the animation command executes.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Bhup

Dear Ishmael or any one else that wants to help :P
Sorry to bother you again but I am a little confused.  I know how to create new objects by clicking on the "New Objects" button in the "Room Editor" under "Objects" but I don't understand the bit about :

"click on the room view to place it, set it's view to the view you've made for the animation, and tick the box to hide the object."

Do you mean the "Change image" button in the "Objects" section of the "Room editor"?

If so then the thing is the lifebuoy is part of the background and I have made it into a hotspot in the "Room Editor" under "Areas".  I have created a script containing the following commands:

SetObjectView(0,3);
AnimateObject (0,0,40,1);

This script was created by clicking on the interaction button for the hotspot which I have labelled as ring (don't ask me why I called it this), in the Room Editor under Areas.

What I want to do is run an animation when an inventory item (in this case a rope attached to a sword), is used to click on the lifebuoy (the hotspot).  So far this displays the view3 i.e. each of the frames, but the bottom left hand corner or the starting position of each frame starts somewhere in the middle of the screen. 

Ishmael, are you saying I should convert the hotspot into an object? If so then I will try it but it means having to go back to the drawing board. If that is the only way then so be it.  Is this the what you mean?  :)

Slightly confused
Bhup

Pumaman

These commands:

SetObjectView(0,3);
AnimateObject (0,0,40,1);

are animating Object 0. Therefore, the animation will take place at wherever Object 0 is on the screen, and this is set by where you place it on the Objects tab.

You cannot animate a hotspot since it is a static part of the background, but you can have an animating Object on top.

Ishmael

By saying "set it's view to the view you've made for the animation" I meant using SetObjectView and to set the view to that animation. As you have done with that script already.

Just set the object graphic to something that you can find on the background if you need to move it a bit if the animation looks misplaced.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Bhup

Dear Ishmael   :),
Thanks for all your advice.  I'll give your last comment a go.  It seems to make sense.  Thanks a lot ;D Do we give out points for something like this???  Since I don't have any to give.  In Java they give out credits and if you have a certain number of credits you get a prize. Is it the same here??

Thanks Punaman.  Just one thing...err..hope you don't mind me saying that I am allready aware of the fact that you can't animate a background but you can create an animation as a result of clicking on a hotspot in the background.  My problem was that the animation started at halfway in the middle of the screen where my hotspot, which was part of the background, was.  But I think Ishmael has solved the problem.  :)

Thanks everyone!!
Bhup

Bhup

Dear Pumaman
Actually I meant I should be thanking Pumaman for the advice about Objects 0.  I am thinking of creating an 'object' that is hidden and putting it in the extreme bottom left hand corner.   I am not sure how to hide it.  Any ideas?? Meanwhile I will have a hunt around in help.  Could sure do with your advice again though Pumaman.

P.s. Is there any way we can change elements of our profile???
Bhup :)

Pumaman

Objects have a "Object is initially visible" checkbox in the editor. Just un-check this, then un-hide the object when you want to run the animation by using ObjectOn.

Bhup

Dear Pumaman and Ishmael I thankyou both for helping me. 
:-* If I could read like the "idiot" I am I would have read your comments earlier.    :-[  Had i been more focussed I would have understood what you were saying.   ;D I have just learned how to hide the object!

Sorry Pumaman for asking such a trivial question in the wrong Forum.  :-[
Bhup

Bhup

Dear Pumaman or anyone else that is interested in answering my question.

I have so far  written the following code:

SetObjectView(7,3);
ObjectOn(7);
ObjectOff(0);


AnimateObject (7,0,40,1);

It works...the animation now starts at the bottom left of the screen where I placed the "default blue cup".  But what I am now looking for is a way to allow the user to escape the animation by clicking or pressing on the Escape key (code 27).

I have created the following code:
SetObjectView(7,3);
ObjectOn(7);
ObjectOff(0);

while(IsKeypressed(27) != 1){
AnimateObject (7,0,40,0);
}

But it only displays the first frame of view 3.

Basically it doesn't work.  What am I doing wrong please???
Bhup :'(

Scorpiorus

Try the following:

SetObjectView(7,3);
ObjectOn(7);

AnimateObject (7,0,40,0);
while ((IsKeypressed(27)==0) && (IsObjectAnimating(7)==1)) Wait(1);

ObjectOff(0);

Bhup

Dear Scorpirous,

I did what you told me to do but it only put a timer in place of the cursor.  I did:

SetObjectView(7,3);
ObjectOn(7);

AnimateObject (7,0,40,0);
while ((IsKeyPressed(27)==0) && (IsObjectAnimating(7)==1)) Wait(1);

ObjectOff(0);

What happened is that it went through the animate sequence once then stopped.  But thats what animateObject was programmed to do err...Go through animate sequence once. :P

What I want to do is loop the animated sequence and  allow the user to escape the animation any time.

I tried changing the number of times the animation was played by swapping the 1 to a zero in AnimateObject.  Sure enough it looped but the while statement you gave me does not seem to work ???  If its supposed to allow the user to escape it does not work ???
Bhup

Bhup

Is there anyone out there prepared to answer the above question.  Or is Christmas keeping every one at bay. ;D
Hope to hear from someone soon.
Bhup

SMF spam blocked by CleanTalk