Basic Tutorial for SCI1.1 - Actors: Difference between revisions
No edit summary |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
<div align="center"> | <div align="center"> | ||
Chapter: | Chapter: | ||
[[Customizing the Title Screen|1]] | | [[Basic Tutorial for SCI1.1 - Customizing the Title Screen|1]] | | ||
[[The First Room|2]] | | [[Basic Tutorial for SCI1.1 - The First Room|2]] | | ||
[[Interacting with Objects|3]] | | [[Basic Tutorial for SCI1.1 - Interacting with Objects|3]] | | ||
[[Adding a Background and Static Objects|4]] | | [[Basic Tutorial for SCI1.1 - Adding a Background and Static Objects|4]] | | ||
[[The Priority Screen|5]] | | [[Basic Tutorial for SCI1.1 - The Priority Screen|5]] | | ||
[[Animating Props|6]] | | [[Basic Tutorial for SCI1.1 - Animating Props|6]] | | ||
[[Managing the Player’s Inventory|7]] | | [[Basic Tutorial for SCI1.1 - Managing the Player’s Inventory|7]] | | ||
[[Actors|8]] | | [[Basic Tutorial for SCI1.1 - Actors|8]] | | ||
[[Dying|9]] | | [[Basic Tutorial for SCI1.1 - Dying|9]] | | ||
[[Using Inventory Items|10]] | | [[Basic Tutorial for SCI1.1 - Using Inventory Items|10]] | | ||
[[Scoring and Flags|11]] | | [[Basic Tutorial for SCI1.1 - Scoring and Flags|11]] | | ||
[[Adding a Second Room|12]] | [[Basic Tutorial for SCI1.1 - Adding a Second Room|12]] | ||
</div><br /> | </div><br /> | ||
Line 128: | Line 128: | ||
| | ||
<span style="float: left">[[Managing the Player’s Inventory|< Previous: Managing the Player’s Inventory]]</span> | <span style="float: left">[[Basic Tutorial for SCI1.1 - Managing the Player’s Inventory|< Previous: Managing the Player’s Inventory]]</span> | ||
<span style="float: right">[[Dying|Next: Dying >]]</span> | <span style="float: right">[[Basic Tutorial for SCI1.1 - Dying|Next: Dying >]]</span> | ||
| | ||
[[Category:Technical Info]] | [[Category:Technical Info]] | ||
Line 139: | Line 139: | ||
[[Category:SCI Tutorials]] | [[Category:SCI Tutorials]] | ||
[[Category:Actors]] | [[Category:Actors]] | ||
[[Category:Actors | [[Category:SCI Actors]] |
Latest revision as of 18:01, 28 April 2025
Let's add another character! Open the template ego character, and **Save As** a new view resource (say view number 1).
Then use the shift color functionality to change the colors so he looks different. This evil ego will wear grey clothing and have purple skin.
Go into your room script file and add a new :class:`Actor` at the bottom:
(instance evilEgo of Actor
(properties
view 1
x 231
y 131
signal ignAct
noun N_EVILEGO
)
)
Also add the N_EVILEGO to the message resource (you should be good at this now).
Now go up to the room's init() method and initialize the evil ego:
(evilEgo
init:
setCycle: StopWalk -1
)
StopWalk
is the standard Walk cycler that will switch to a special loop or different view when it is stopped. We don't have a different view,
but the ego view we used has a special 9th loop that is used for the stop pose. In this case, -1 says to use the final loop of the view as the stop pose.
Compile and run the game (you may need to (use "StopWalk")), and you should see the evil ego standing menacingly on the other side of the room.
Maybe give him some messages so you can look at him or talk to him:
Now let's make him wander around:
(evilEgo
init:
setCycle: StopWalk -1
setMotion: Wander
)
You'll need to (use "Wander"). Compile and run, and you'll see him wander around. setMotion sets a :class:`Motion` class on an :class:`Actor`. This is used to control how the Actor moves.
You might notice that he'll walk right through walls. The :class:`Wander` Motion doesn't obey the room obstacles, so it's not very useful for us here.
The Motion classes that obey obstacles generally start with the letter P. So maybe we can use PFollow
instead:
(evilEgo
init:
setCycle: StopWalk -1
; Follow the ego to a distance of 20
setMotion: PFollow gEgo 20
)
Compile and run the game, and now he'll be following the ego around!! That's a bit scary, so let's slow him down:
(instance evilEgo of Actor
(properties
view 1
x 231
y 131
signal ignAct
noun N_EVILEGO
moveSpeed 30
cycleSpeed 30
)
)
Now we at least have a chance to escape.
References
Also See