Wintermute Engine > Technical forum

Second actor creation and cutscene

<< < (2/4) > >>

Indra Anagram:
Hey anarchist!

Great insights/pieces of advice! THANK YOU for such detailed recommendations.

You wrote:


--- Quote ---About the scrolling, I don't know how much you have learned so far. I haven't used scrolling in my game. I suggest that you take a look at the basics if you are not certain:

http://docs.dead-code.org/wme/inside_scenes_step1.html

And make sure you follow the rules of scrolling, which is setting the main layer dimensions to be larger than the game's resolution.
--- End quote ---

I already made this in the very beginning, because my background image is 2347 X 600 and yes, I was following the lesson that you recommended. Whenever the main actor walks to the right, the scene scrolls perfectly, yet you understood this wasn't the objective this time:


--- Quote ---Apart from that, in order for the actor to move beyond the edge and for scrolling to start, you have to extend your floor region to the whole scene. Furthermore, you can force the scene to scroll by using Scene.ScrollTo() or Scene.SkipTo().
--- End quote ---

I needed the actor to stop, actor 3 (let's call him "guy") makes a simple animation, says his words and then the scene scrolls sidewards on its own, as if camera was moving to the right without the actor walking there.

I found the method that you kindly told me about - Scene.ScrollTo() in Script Language Reference, however neither Documentation nor WME Book Online contained any examples of its practical use. Script Langeage Reference -> Scene object says:


--- Quote ---ScrollTo(X, Y)
ScrollTo(Object)
ScrollToAsync(X, Y)
ScrollToAsync(Object)
Scrolls the scene to the given point / object.
Parameters
X
X coordinate of the target scroll position
Y
Y coordinate of the target scroll position
Object
An object (actor/entity) to be used as a new target scroll position
Remarks
The Scene.AutoScroll attribute must be set to true for this method to work. ScrollTo method blocks the script execution until the scrolling is over, while the ScrollToAsync method returns immediately.
--- End quote ---

I don't quite understand what the code could look like  :-\ Can you please share your ideas on this method? Step 7 is all about this scroll. Should I use actor 4 as Object parameter? Is that possible? Maybe guy.Talk triggers this scrolling?

As for other custscene steps:

Step 4) Sally goes to the right, main actor follows her and the scene scrolls with them
Step 5) They both stop where the floor (walking area) ends
Step 6) Actor 3 is visible now. He makes a simple movement (sprite animation I guess) and says his scripted line

It looks like these are achieved. Modified scene_init.script. Please view this script:


--- Code: WME Script ---// setup scene according to state variablesif(StateRoom.Visited==false){  Game.Interactive = false; // We remove the control from the user.  Sleep(3000); // Wait for three seconds before Sally says her line.  sally.Talk("Have you ever played billiard?"); //Sally asks her question.   // and let the dialogue begin  SallyDialogue();   //Sally and actor go to the right  sally.GoToAsync(800, 576);  Sleep(1000);  actor.GoToAsync(750, 578);  Sleep(2000);    //4 seconds before Guy's animation, so that actor and Sally had enough time to get there.  Sleep(4000);    //Guy makes his simple movement, waits for 2 seconds and asks a question.  guy.PlayAnim("actors\guy\play\play.sprite");  Sleep(2000);  guy.Talk("So, what's up?");      StateRoom.Visited = true;  Game.Interactive = true;}  
PlayAnim worked like magic! Brilliant idea of yours, anarchist.

Earlier in the code, right after loading actor and sally, I loaded guy (actor 3). Have I done it correctly?


--- Code: WME Script ---//load Guyguy = Scene.LoadActor("actors\guy\guy.actor");guy.SkipTo(953, 536);guy.Direction = DI_DOWN;guy.Active = true;
I have a problem with guy and billiard table, though. The table is an entity on a separate layer and it has parallax effect. In the screen below you can see it overlaps guy. I see the guy sprite must be a bit bigger, but it would be better if the cue was over the table, not behind it, lol) I don't know how to make this either.



Honestly, without your help I wouldn't have managed a thing.

Indra Anagram:

--- Quote from: anarchist on November 11, 2017, 01:11:29 AM ---Furthermore, you can force the scene to scroll by using Scene.ScrollTo() or Scene.SkipTo().

--- End quote ---

anarchist, I added this to scene_init.script:


--- Code: WME Script ---  //load husband  husband = Scene.LoadActor("actors\husband\husband.actor");  husband.SkipTo(1541, 535);  husband.Direction = DI_LEFT;  husband.Active = true;    Scene.AutoScroll = true; //The scene can scroll automatically.  Scene.SkipTo(husband); //Scroll the scene to husband.
The reason for Scene.SkipTo() is that Scene.ScrollTo() does not work at all. With Scene.ScrollTo() everything freezes without any change. However, Scene.SkipTo causes view to jump to "husband" and then slowly scrolls to the left till we see three previous actors again  ;D While it is supposed to be vice versa: from those three actors the view should slowly scroll to "husband".

I don't know how to fix this... Guess Scene.SkipTo() is not what I need, but Scene.ScrollTo() does not work... Or I write something in a wrong way ((

Please help me to solve this. And a question from my previous post about the "table" entity overlapping "guy" actor is still open.

THANK YOU for your advice!

anarchist:
I haven't used scrolling in my scenes so I will try to help you a bit blindly.

From the documentation I can see that:


--- Quote ---Scene.Autoscroll: Specifies whether scene automatically scrolls to the Game.MainObject
--- End quote ---

By default, in game.script you will find the following line:


--- Code: WME Script ---Game.MainObject = actor; 
So it makes sense that, when you set Game.Autoscroll = true the scene scrolls toward the main actor. Also from the documentation:


--- Quote ---MainObject: The object which is used for the scene's auto scrolling, can be (set to) null

--- End quote ---

So it can be set to null. Perhaps this would work?


--- Code: WME Script ---Game.MainObject = null;Scene.AutoScroll = true;Scene.ScrollTo(husband); 
After you have done the scrolling and dialogue etc. I think you will want to:


--- Code: WME Script ---Scene.AutoScroll = false;Game.MainObject = actor; 
As I said above, I am working blindly, but from what I read in the documentation, the behaviour you observe does make sense, so I think this will work.

Indra Anagram:

--- Quote from: anarchist on November 18, 2017, 03:42:01 PM ---As I said above, I am working blindly, but from what I read in the documentation, the behaviour you observe does make sense, so I think this will work.

--- End quote ---

Yes, anarchist, the code that you came up with works perfectly!  ::rock
The whole scene now scrolls to "husband" actor smoothly. Do you happen to know if it is possible to speed up scrolling speed? Or it is not a changeable feature?

You were helping me *blindly*, without any use of scrolling in your project, wow! I am so impressed and sooo grateful to you!

THANK YOU, anarchist! You and NAItReIN are my heroes. Without you, guys, I don't know how I'd even crack all this scripting. Guess this is the pure question of experience.

anarchist:
I don't have any special talents, I simply have been working as a professional programmer for years (and on Wintermute for some years too), which among other things gives you the ability to find solution to your problems through searching (either the documentation or the Internet in general). As you said, it is a matter of experience.  8)

Scroll speed is an attribute of the Scene object. From the documentation http://docs.dead-code.org/wme/generated/scripting_ref_scene.html:


--- Quote ---ScrollSpeedX: Horizontal scrolling speed (in milliseconds, default=10)
ScrollSpeedY: Vertical scrolling speed (in milliseconds, default=10)
ScrollPixelsX: Horizontal scrolling shift (in pixels, default=1)
ScrollPixelsY: Vertical scrolling shift (in pixels, default=1)
OffsetX: Current horizontal scrolling offset of the scene
OffsetY: Current vertical scrolling offset of the scene

--- End quote ---

You can play with these to get what you want.

What goes around comes around. This forum helped me a lot in my game, so I am simply returning the kindness I received. Kindness breeds kindness, I am sure you will do the same some day.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version