lcl's GE lessons - PART 2A (Actor Control panel and Clones)

Learn how to make certain types of games and use gameEditor.

lcl's GE lessons - PART 2A (Actor Control panel and Clones)

Postby lcl » Thu May 01, 2014 11:51 am

Hello all!

This is part A of the second part of my series of Game Editor lessons. In this part, we will have a look at the basic things on the Actor Control panel, and also go through the concepts of clones and cloning. Part B of the second part of the series will focus on the rest of the things on the Actor Control panel, including Tile drawing, Text actors and Animations.

I will use the acronym MATL (= More About That Later) to tell you that I have more to say about something, but won't explain it in this lesson, because I consider it out of the bounds of the topic of the current lesson.

Actor Control panel is the window that is open when ever you open Game Editor. Here's what Actor Control panel looks like.
l2i1.png

As said, the panel is open when you start Game Editor, so you don't need to go anywhere to access it. If you close Actor Control for some reason, you can always open it by right clicking any actor and selecting 'Actor Control'.

Now let's go through the basic things on the panel.

The simplest stuff
  • Name - This shows the currently selected actor's name. You can select an actor by clicking on it, or by clicking the button on the Actor Control panel and then choosing the desired actor from the pop-up list. Actors that have multiple clones have a '+' in front of their name, and by clicking that '+' you can select a certain clone. Selecting an actor will center the editor on that actor.
  • Transparency - This slider can be used to set the transparency of the selected actor. Hold mouse over the bar to see the actor's current transparency value. When the slider is at the left end of the bar transparency is 0, meaning that the actor is not transparent at all. When the slider is at the right end of the bar transparency is 1, meaning that the actor is almost completely transparent. Setting transparency to 1 should never be a way of making something invisible, because the actor will still be a little visible. For that, use VisibilityState instead. (MATL)
  • Z Depth - This slider can be used to set the z depth of the selected actor. Hold mouse over the bar to see the actor's current z depth value. Z depth means how 'deep' the actor will be in the z axis. 0 means that the actor has the lowest possible z depth value, so all other actors will appear on top of it, covering it. 1 means that the actor is on top of all other actors.
  • Remove - Clicking this button will remove the currently selected actor or clone.
  • Stop - Opens a pop-up menu with options 'Move' and 'Stop'. When this is set to 'Move' the actor's current animation will play in the editor and the actor will move along its current path. When set to 'Stop' the animation will return to frame 0 and the actor will move back to its original position.
  • Normal - Will open a pop-up menu with options 'Infinite', 'x Infinite', 'y Infinite' and 'Normal'. If option 'Infinite' is selected the actor will be shown repeated on the whole game area. If option 'x Infinite' is selected, the actor will be shown infinitely on the x axis, for 'y Infinite' on the y axis. When 'Normal' is selected, actor will be shown normally.
  • Create at startup - By default all actors in the editor will be created when the game is opened, but by this option, you can set some to not be created when the game starts. These actors can be later created by using CreateActor command. (MATL)
  • Parent - Here you can select a parent for the current actor. When a parent is set for an actor, the actor will inherit the parent's transparency, z depth, r, g and b values. The actor's coordinate system will also change so that the 0,0 point for it's x and y isn't anymore the 0,0 of the game world, but instead the x and y of the parent actor. This being said, the actor will move when the parent moves, so it looks like the actor is attached to it's parent.
  • Path - By clicking this button you'll open a pop-up list with the names of all the paths the current project has. By clicking on one of the names, you can give that path to the current actor at the beginning of the game. (Paths, MATL)
  • Events (Add, Edit and Remove) - Via these buttons you can add events and actions to the current actor, edit the them and remove them. Basically events mean when something happens, for example when two actor collide, and actions are what should happen when an event occurs, for example the another actor's animation could change upon collision event. (Events and actions, MATL)
  • Inherit events from - After clicking a button, a list with the names of all different actors will pop up. From this list you can select an actor which you'd like the current actor to inherit events from. When an actor is selected, the current actor will have all the same events and actions as the selected actor and of course, all it's own events and actions. If there are overlaps with the selected actors events and the current, inheriting actors events, the current actors events will be used instead of the inherited events. For example, if your game has multiple controllable characters, there could be one basic player actor with all the basic events like collision with ground and the movement events. Then you can make all the other controllable characters inherit that actors events, and they will have the same collision events with the ground and the same movement will work for them. And if you want to change something specifically for one of these different player actors, for example the movement, just add new key down events with the desired movement code in there and it will be used instead of the inherited movement code. Note that inheriting animation changes requires the inheriting actor to have animations with same names as the actor it's inheriting from.
  • Receive events even if out of vision - Use this option to simply tell the actor if it should keep receiving events and executing actions even when it's outside of the view area. Setting this to 'No' for actors that don't need to function outside of the view can make your games work smoother, as there will be less processing having to be done simultaneously.


Cloning and clones

What are clones?
Clones are duplicated actors. The name 'clone' misleads some people into thinking that clones and actors are different objects in Game Editor, but that's not the case. In Game Editor it is possible to have multiple instances of one single actor, and when there is multiple instances of a single actor, you just call them clones instead of actors. So clones and actors are the same thing, clones are identical copies of the cloned actor. Clones are identified by their cloneindexes. The first clone, e.g. the original actor has cloneindex 0, the second one has cloneindex 1, etc.



Why should I use clones?
Clones can be used when there is some element that should have multiple instances of itself in a game. For example things like collectables, enemies, doors, visual effects, etc. can be clones.

For example if your game has collectable coins in it, like in Super Mario, you can just create an actor, give it ananimation of a coin and add an event to it that when it touches you it adds 10 points to the player's score and then destroys itself. Then, now that you have specified the events and animations for the coin, you can just clone it and place the clones into different places in your game worldin Game Editor. You can also add and modify the events of the coin after cloning it, the changes will be made to all the instances of the coin actor, those already created and those to be created later on, they're all clones of each other so they always share the same events and actions.



How should I use clones?
When working with clones you have to remember one thing, and it is that if you're not clone-specific, the events and actions will either affect all clones, or just the clone with cloneindex 0.

A simple example would be the situation where you have an enemy actor called "Enemy" which has multiple clones and you want that actor to be destroyed when it touches a bullet shot by the main character of the game. You would add a collision event to the enemy actor with the bullet actor, and then have a DestroyActor call to destroy the enemy actor. But that's where you have to pay attention, if you set the DestroyActor event to destroy "Enemy", shooting one enemy will destroy all of them. What you want to do is to destroy only the enemy that has touched a bullet, so you would use "Event Actor" instead. Now only the enemy that has touched a bullet will be destroyed and the others will stay unharmed.

Another example of having to remember to be clone-specific, would be destroying the bullet actor, since if there can be multiple bullets on the screen simultaneously, they will also be clones. Now, let's say that your enemy actor has a shield that it lifts up every 5 seconds, and if a bullet hits the enemy when the shield is up, the bullet will be destroyed instead of the enemy actor. Now let's skip the part with checking if the shield is up or not, but let's just go to the enemy's collision event with the bullet and add the DestroyActor command when the bullet has touched the actor. Now here is the same thing again, you can't just tell DestroyActor to destroy the actor called "Bullet", because it would destroy all the bullets, also the one's currently flying in the air not touching any enemy. You should use "Collide Actor" instead, since it will then destroy the actor that has activated that current actor's specific collision event, in this case, that single clone of the bullet actor.

Here's a list of the clone-specific options you can use on most of the commands: "Event Actor", "Parent Actor", "Creator Actor" and "Collide Actor". Note that these are not any other actor types, these are simply clone-specific expressions for referencing the current actor, current actor's parent actor, the actor that has created the current actor by calling CreateActor and the actor with whom the current actor shares the current collision event.

Being clone-specific is also crucial when programming. (Clone specific programming, MATL)



How can I create clones?
Clones are created when you use the 'Clone' option on Actor Control panel, and also when you call CreateActor command to create multiple instances of an actor while in-game.

Creating clones via the Actor Control panel

Clicking the 'Clone' button on the panel opens a list of different choices for cloning. These choices are:
  • Single - Creates one single clone of the actor.
  • Array - Opens a window which allows you to clone an array of clones. You can specify how many clones there should be horizontally, how many vertically, and what the distance between them should be. You can experiment with the options to see the results, it's very simple. When the distance between clones is set to 'Automatic', you can't adjust the distance values, but if you set it to 'Manual', you are free to adjust the values. By default the values are set so that the clones will be touching each other by their edges.
    l2i2.png
  • Along Path - Opens a window which allows you to select a path and how many clones will be created on that path. All clones will be created equal distance away from each other on the path
    l2i3.png


That's all this time, there's no excercises on this lesson. Feel free to try out and experiment with all the things explained, though.
If you wonder why this lesson was split in two pieces, the reason was the length. Even now this first part may be too long for someone. If that's the case for you, let me know, and I'll try to write less next time. :mrgreen:

Your opinion about the lesson
thumbs.png
thumbs.png (2.56 KiB) Viewed 8612 times

This is first time I'm trying to do something like this, and because of that, I may be doing things in a wrong way.
If you feel you have something to say to help me teach better, just bring it up and I'll see what I can do. I want to do this as well as I can and for that I need help from the people I'm teaching.
Attachments
geLessons3.png
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby digiot » Fri May 02, 2014 2:25 pm

Everything well explained, that must consist of some words !
Clones :
Have I got it right now, whenever you call an actor by its naked name, without any
index appended, you are accessing all the clones of that actor, from actor[0] to
actor[lastclone] ?

And given, we have an actor[0] with 9 clones (actor[0] - actor[9]), and e.g. actor[5]
gots blasted off (DestroyActor).
What will happen with the index list of that actor ?
Is the missing clone now actor[-1], or NULL ?
Or is it deleted from the list, and the indexes above in the list are getting shifted
down by 1, and the new index list for that actor were actor[0] - actor[8] ?

Again, you did a great job, its just me, with my lacking practice, who is seeing
some problems, where all is so obvious and clear and logical.
But I have made some progress, all that cloning thing seems to be demystified for me, now.

Cheers !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby lcl » Fri May 02, 2014 4:41 pm

digiot wrote:Have I got it right now, whenever you call an actor by its naked name, without any
index appended, you are accessing all the clones of that actor, from actor[0] to
actor[lastclone] ?

Yes, that is correct, but only when you're dealing with the predefined GE commands such as DestroyActor, MoveTo, etc.
When ever you are referencing actors through code, like this
Code: Select all
myActor.x = 150;

It only applies to clone with the cloneindex 0.
For being able to reference a certain clone by it's cloneindex, or all of the clones, functions like getclone or getclone2 (the getclone2 is available only in GE 1.4.1).
Code: Select all
getclone("myActor.5")->x = 150;
//or with getclone2
getclone2("myActor", 5)->x = 150;

But in the tutorial I was speaking about the case when using GE's built in commands, and was going to explain code referencing later, when I actually get to talk about coding in the first place.
Of course referencing clones should be here, now that I think of it.. Got to add that when I get some time.

digiot wrote:And given, we have an actor[0] with 9 clones (actor[0] - actor[9]), and e.g. actor[5]
gots blasted off (DestroyActor).
What will happen with the index list of that actor ?
Is the missing clone now actor[-1], or NULL ?
Or is it deleted from the list, and the indexes above in the list are getting shifted
down by 1, and the new index list for that actor were actor[0] - actor[8] ?

The thing you first suggested will happen. The current clone's cloneindex will be changed to -1 as a mark of it not existing anymore. You can't access it by cloneindex -1 of course, because it doesn't exist anymore.
Other clones' cloneindexes will remain unchanged. So after destroying clone with cloneindex 5, the indexes are now 0, 1, 2, 3, 4, 6, 7, 8, 9.

The -1 is the cloneindex for an actor that's nonexistent, for example, a normal not cloned single actor will have cloneindex 0 when it exists, and -1 after it gets destroyed.

digiot wrote:Again, you did a great job, its just me, with my lacking practice, who is seeing
some problems, where all is so obvious and clear and logical.
But I have made some progress, all that cloning thing seems to be demystified for me, now.!

Don't be ashamed of asking, and don't think I take it as an expression of my teaching not being good enough. Asking questions is essential for learning, and being able to ask questions already shows that you have understood the basic concept of the thing you are asking more about. Also, I'm doing this first time in my life and it's very probable that I will always forget to mention something, and the fact that you and others keep asking more helps me to update these lessons and make them better for everyone to learn from them.

Ask more if my explanations weren't clear enough :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby Hares » Sat May 03, 2014 2:36 pm

lcl wrote:
digiot wrote:And given, we have an actor[0] with 9 clones (actor[0] - actor[9]), and e.g. actor[5]
gots blasted off (DestroyActor).
What will happen with the index list of that actor ?
Is the missing clone now actor[-1], or NULL ?
Or is it deleted from the list, and the indexes above in the list are getting shifted
down by 1, and the new index list for that actor were actor[0] - actor[8] ?

The thing you first suggested will happen. The current clone's cloneindex will be changed to -1 as a mark of it not existing anymore. You can't access it by cloneindex -1 of course, because it doesn't exist anymore.
Other clones' cloneindexes will remain unchanged. So after destroying clone with cloneindex 5, the indexes are now 0, 1, 2, 3, 4, 6, 7, 8, 9.

And what happens when you create a new clone after that? Will it get index 5? Or will it get 10?
User avatar
Hares
 
Posts: 105
Joined: Fri Dec 20, 2013 8:39 pm
Location: Belgium
Score: 14 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby CrackedP0t » Sat May 03, 2014 5:03 pm

Hares:
It will get 10.
/人 ◕‿‿◕ 人\
Fang Pictures, my game development company:
http://fangpictures.comuf.com
User avatar
CrackedP0t
 
Posts: 157
Joined: Mon Dec 30, 2013 5:49 pm
Location: Crested Butte, CO (The US of A)
Score: 8 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby tvz » Sat May 10, 2014 12:14 pm

I understood it all. Few Qs.
■ We have 2 actors, A ane B. A has random timer in event and B inherits events from A. will that timer produce different number for both the actors A and B?
■ that + before the clone name is a button to select clone?
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby digiot » Sat May 10, 2014 8:51 pm

@tvz :
tvz wrote:■ We have 2 actors, A ane B. A has random timer in event and B inherits events
from A. will that timer produce different number for both the actors A and B?

You seem to be irritated like me, no, every of your both actors will run its own
version of that random timer event (Hope, I've got it now!).
But that does not guarantee, that you will get two different rnd-values !
tvz wrote:■ that + before the clone name is a button to select clone?

Yes, was new for me, too.

@lcl : You are trying, to carefully divide the GE-GUI and the coding, to start from the
very basics, and then, step by step, recovering more and more of it, fine.
But that will not work !
Like in the Bundies title song: "dada-dada--you-can't-have-one-without-the-o-ther..."
As soon, as you have an actor, you need to "code", like actor.x += 10, etc..
And even worse, you are thrown into the deepest pointer hell in the same moment !
With a little "sweeping blow" here and there, you might keep your concept, I'm
sure, you'll master it !

Bear with me, but to have this cleared :
lcl wrote: myActor.x = 150;
It only applies to clone with the cloneindex 0.
For being able to reference a certain clone by it's cloneindex, or all of the clones, functions like getclone or getclone2 (the getclone2 is available only in GE 1.4.1).
getclone("myActor.5")->x = 150;
//or with getclone2
getclone2("myActor", 5)->x = 150; >

So there is no way to access all the clones of an actor in code than looping through
it with getclone/getclone2 ?

Not only referencing clones should be a deeper look worth, also creating and destroying
actors is essential.

Afaik, all the actor(-structs) are stored in an actor-array ?
Let's create some actors, single ones, and with clones, now,
will the actor-array look like this :
Code: Select all
Actor1[0][0], Actor2[1][0], Actor3[2][0], Actor4[3][0], Actor5[4][0]...
                                          Actor4[3][1],
                                          Actor4[3][2],
                                          Actor4[3][3],

or am I wrong ?


Now let's kill some actors again, Actor2 and the 2nd clone of Actor4, does it
look like this now :
Code: Select all
Actor1[0][0], Actor2[1][-1], Actor3[2][0], Actor4[3][0], Actor5[4][0]...
                                           Actor4[3][1],
                                           Actor4[3][-1],
                                           Actor4[3][3],

i.e. the destroyed actors are not deleted, they just are marked as "out",
only with the "Remove"-button in the "Actor-Control" you can totally delete
an actor ?

And how shall I interpret this statement in the GE-docs :
GE-doc wrote: Any Actor can be loaded with "Create Actor", even if has been destroyed explicitly.

Does that mean, Actor2[1][0] and Actor4[3][0] in this case could be reloaded manually,
with all its last values, like re-entering any Activation Region ?
Or does leaving the Activation Region result in annother index-mark, e.g. -2, and the
handling of that actor differs from that of a "normal" [-1]-actor ?

You see, even on this entry level, there may appear some problems...


Cheers !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby lcl » Sun May 11, 2014 7:05 pm

digiot wrote:@lcl : You are trying, to carefully divide the GE-GUI and the coding, to start from the
very basics, and then, step by step, recovering more and more of it, fine.
But that will not work !
Like in the Bundies title song: "dada-dada--you-can't-have-one-without-the-o-ther..."
As soon, as you have an actor, you need to "code", like actor.x += 10, etc..
And even worse, you are thrown into the deepest pointer hell in the same moment !
With a little "sweeping blow" here and there, you might keep your concept, I'm
sure, you'll master it !

Let me clarify one thing.
It is required for all of you to have a good knowledge on the basic non-coding parts of Game Editor before I can start teaching you about coding.
This is the reason why I have decided to divide them and the whole lesson thing will go like this:

1. Game Editor's basic functionality: user interface, actors, tile drawing, etc.
2. Basics of coding in Game Editor: keywords, functions, etc.
3. Combining the above two: making games in Game Editor by coding.

This is the reason why I didn't want to speak about coding here. I need to first cover the basics of coding before I can start talking about it at all.
Not anyone has the required basic knowledge about coding in Game Editor to understand even the most simple examples of clone specific coding.

If I was to include information about referencing clones in code to this lesson, it would require this lesson to thoroughly explain Actor* pointer, functions, keywords variables, etc. pretty much the basics of coding. And that would drive the attention away from the center of this lesson. Doing that would also break my organized plan of how these lessons will progress, and it would end up in a mess with no reasonable order in any of it. That's the reason for this statement:
lcl wrote:Being clone-specific is also crucial when programming. (Clone specific programming, MATL)

This requires you to be patient. I know that you're eager to learn about Actor* pointer and referencing clones in coding, but it's just not the time for that yet.

digiot wrote:So there is no way to access all the clones of an actor in code than looping through
it with getclone/getclone2?

Correct, if we don't take into account the same functions that can be used via the GUI windows, DestroyActor for example, this will still destroy all clones if handed only the actor's name instead of a single clone's clonename.
But referencing them through code the same way as you can do with single actors requires the use of getclone/getclone2.
But I will cover all this very thoroughly later on in the lessons.

digiot wrote:Afaik, all the actor(-structs) are stored in an actor-array ?
Let's create some actors, single ones, and with clones, now,
will the actor-array look like this :
Code: Select all
Actor1[0][0], Actor2[1][0], Actor3[2][0], Actor4[3][0], Actor5[4][0]...
                                          Actor4[3][1],
                                          Actor4[3][2],
                                          Actor4[3][3],

or am I wrong ?

It's pretty much impossible for me to say how Game Editor handles the clones, if it is an array or not, and actually, you don't need to know that when making games with GE.
It's highly probable that they are stored in an array, but I can't say anything for sure.

digiot wrote:i.e. the destroyed actors are not deleted, they just are marked as "out",
only with the "Remove"-button in the "Actor-Control" you can totally delete
an actor ?

No, when you destroy actors / clones, they are actually destroyed and can't be accessed anymore. Trying to access will just return a - 1 for cloneindex and "" for name:
GE documentation wrote:getclone: Get Actor with name cloneName.
Actor *getclone(char *cloneName)

cloneName: nameactor.cloneindex
(Example: ship.1, ship.2, ...)
Return Actor if successful, invalid Actor (with cloneindex = -1 and name = "") on error.


digiot wrote:
GE documentation wrote:Any Actor can be loaded with "Create Actor", even if has been destroyed explicitly.

Does that mean, Actor2[1][0] and Actor4[3][0] in this case could be reloaded manually,
with all its last values, like re-entering any Activation Region ?

No, once destroyed, you can't load clones with all their values back. What this means, is simply that if you have an actor in your game, and you destroy it, you can use CreateActor to create it back in to the game.
All the actor's variables will be reset when doing this.

digiot wrote:Or does leaving the Activation Region result in annother index-mark, e.g. -2, and the
handling of that actor differs from that of a "normal" [-1]-actor ?

No. You seem to have misunderstood one thing. You can't access destroyed actors, nor clones, and you also can't access actors outside the currently active Activation Region.
-1 is just returned for the cloneindex as a value that is given upon an error, so in other words, when the clone doesn't exist at all.
I'm sorry, I see now that my words led you to thinking that actors would still exist after destroying, just with a cloneindex of -1, but that wasn't what I meant. I meant that the actor / clone gets destroyed, and as for any destroyed or otherwise nonexistent actor, the returned cloneindex from getclone is -1, the error value.

This level of complexity is one reason for why I didn't want to start speaking about coding with clones yet. You see that it has a lot of things that link to each other, and of most of them, I haven't spoken anything about on my lessons so far.

- lcl -
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby Turon » Mon May 12, 2014 9:53 am

Well... very interesting er um I thought I may have had more to say.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby digiot » Mon May 12, 2014 9:35 pm

lcl wrote:If I was to include information about referencing clones in code to this lesson, it would require this lesson to thoroughly explain Actor* pointer, functions, keywords variables, etc. pretty much the basics of coding. And that would drive the attention away from the center of this lesson. Doing that would also break my organized plan of how these lessons will progress, and it would end up in a mess with no reasonable order in any of it.

No, no, don't shred your lessons, what you said, is also my view, I wouldn't know,
how to manage all that stuff !
But as you have seen, there are coming questions, which are touching the code section,
even in this early part of the lessons.
lcl wrote:This requires you to be patient. I know that you're eager to learn about Actor* pointer and referencing clones in coding, but it's just not the time for that yet.

I'm very patient about that, for the next few months, I don't believe, I can escape
out of the pixel-hell !
And I'm not just waiting for the code lessions, in every of this basic lessons, I will
(and already have!) take(n) some benefit, like the clones, or the actor access only through
the getclone/getclone2 functions, where I thought, a simple "actor.n.actor-var" would
do it.
lcl wrote:I'm sorry, I see now that my words led you to thinking that actors would still exist
after destroying, just with a cloneindex of -1,...

No, that wasn't you, I got already puzzled by the GE-Doc.
And the fact, that actors will get destroyed, if the View leaves the Activation Region,
but beeing reloaded, when the View intersects the Activation Region again.

So there are two possibilities : Eighter, there is the (now "invalid") actor, with its
-1 index, or the actor is really dead, not anymore in the game, the -1 index and the
"" name is just the output of the getclone (and others, too) functions.
lcl wrote:-1 is just returned for the cloneindex as a value that is given upon an error,
so in other words, when the clone doesn't exist at all.

I meant that the actor / clone gets destroyed, and as for any destroyed or otherwise
nonexistent actor, the returned cloneindex from getclone is -1, the error value.

Thanks for clearing this, and for all your work,


Cheers !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby Clovis2 » Mon Jun 16, 2014 1:50 pm

Hello lcl,
I find your lessons very well done and most useful! I am impatient to read those about scripting! I found about nothing concerning that on the web.
Thanks a lot and bravo :D
Clovis2
 
Posts: 1
Joined: Mon Jun 16, 2014 9:47 am
Score: 0 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby Zivouhr » Sat Jul 05, 2014 6:50 pm

Thanks LCL. Your knowledge and efforts are very helpful.
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby Hares » Thu Apr 30, 2015 8:45 pm

Any chance of getting lesson part 2B now?
It's almost been a year ... :mrgreen:
User avatar
Hares
 
Posts: 105
Joined: Fri Dec 20, 2013 8:39 pm
Location: Belgium
Score: 14 Give a positive score

Re: lcl's GE lessons - PART 2A (Actor Control panel and Clon

Postby Zivouhr » Thu Oct 08, 2015 4:57 am

I was studying the information here from LCL and it's helpful, though I have some questions about clones, which sadly cannot be used in "CreateActor" events... :( If they could've, that would've saved tons of time trying to code for them.

So that leads to the challenge with an Actor called "enemy" in this case who is supposed to create two clones from a spawn actor:
For "enemy", I have two character animations, each with a left and right facing animation; enemyR001 for walking right, and enemyL001 for walk left in the animation files for the Actor.

Actor/enemy.0 has enemyL001 and enemyR001 animations (single actor, two clones sharing all 4 animations)
Actor/enemy.1 has enemy2L001 and enemy2R001 animations. (single actor, two clones sharing all 4 animations)

I want both clones of a single actor to spawn from an enemyspawner actor and maintain their animations towards the player.


The problem is, I have a separate actor called "enemyspawn" who is supposed to spawn both enemies. That part I can do, but to get them to face in the left or right direction while both appearing onscreen and to keep their animation smooth without twitching, is where I'm stuck for a week now.

Here's what I tried: Varying from either enemy.0 and enemy.1 , or enemy referred by animindex if that's possible to use for creating two different enemies in the same actor to spawn forth.

enemy/draw actor/script editor:
Code: Select all
if(x>player.x) //< enemy is right side of player
{
ChangeAnimation("Event Actor", "enemyL001", NO_CHANGE);   //enemy facing left
}
else
if(x<player.x)   //< enemy is left side of player
{
ChangeAnimation("Event Actor", "enemyR001", NO_CHANGE);  //enemy facing right
}

MoveTo("Event Actor", 0.0, 0.0, 2.0, "player", "");    //this will move the enemy to the player.


Then I created another for the "enemy" 2nd animation character similar to the above.
The animations were enemy2R001 and enemy2L001 for example, numbers 3 and 4 in the animindex.

... And then for the enemyspawner:
enemyspawn/Timer/script editor: (after creating a CreateActor/Create Timer Event of 3 seconds)
Code: Select all
type=rand(2);   //variable global integer is named "type" created in script editor "Variables" option.
switch(type)
{
case 0:
ChangeAnimation("Event Actor", "enemyR001", NO_CHANGE);   //I had variables here, but no luck.
break;

case 1:
ChangeAnimation("Event Actor", "enemy2R001", NO_CHANGE);   //I had variables here, but no luck.
break;


The above is just an idea/placeholder, since all of my attempts to use variables didn't work to try to plug the different animations into the code. I tried the animindex, and no success there either.
I did try as taught in another thread:

if(e1=1) //enemy animation 1 for the first character enemy
{
direct ++;
if(direct>1)direct=0;
if(direct==1) ChangeAnimation("Event Actor", "enemyL001", NO_CHANGE);
if(direct==0) ChangeAnimation("Event Actor", "enemyR001", NO_CHANGE);
}

And then for the second animated character in the same actor, similar code but a different association to direct. like a variable e2 for example.

Any tips on how to use one actor to create multiple enemies that spawn from a single Actor would be greatly appreciated as I'd like to solve this in time, learn and move on to the next challenge.
Thanks!


EDIT: Ignore the above; was able to figure it out with a tip from Skydereign in a zdepth thread. :idea:
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest