Page 1 of 1

How to? Need help "teleporting" an actor

PostPosted: Wed Feb 16, 2011 11:32 am
by bilvyy
In my game, I have different areas. A city, a zoo, a town, as well as interior rooms. They're all separated from one another.

I need to be able to transport the main actor between these places but I don't know how and I can't find anything in the in-game tutorials.

For example: When the actor walks into a certain 'street' in the city area, he will appear in the entrance to the zoo.

Is this possible? I have tried moving him with collisions but the "Move to" function isn't really what I'm looking for. I'm hoping for the 'teleport' to be instant.

Thank you in advance for any suggestions.

P.S. I'm hoping that this method will help me transport the actor "indoors" as well. I need to be able to transport him to one of the interior scenes when he collides with the specific door.

EDIT: I apologise if this is in the wrong forum, I haven't posted before and I'm hoping I haven't made any mistakes.

Re: How to? Need help "teleporting" an actor

PostPosted: Wed Feb 16, 2011 11:58 am
by schnellboot
http://game-editor.com/forum/viewtopic.php?f=4&t=9806
this is lcl's door script which can solve all your problems

bilvyy wrote:EDIT: I apologise if this is in the wrong forum, I haven't posted before and I'm hoping I haven't made any mistakes.

this should be in Support, but it doesnt matter I think ^^

Re: How to? Need help "teleporting" an actor

PostPosted: Thu Feb 17, 2011 11:02 pm
by bilvyy
thank you very much! i'll try it now (:

Re: How to? Need help "teleporting" an actor

PostPosted: Fri Feb 18, 2011 12:09 am
by again
I made GED to help you its much simpler and its located here

viewtopic.php?f=2&t=10043

Re: How to? Need help "teleporting" an actor

PostPosted: Sun Feb 20, 2011 7:02 am
by lcl
again wrote:I made GED to help you its much simpler and its located here

viewtopic.php?f=2&t=10043

Kren, yeah your code is easily understandable, but think of using it when there
is over hundreds of doors! I mean, you always have to create new actor and add those events to it
and even create one variable more. So, with 100 pairs of doors you would have 100 variables and it's awful
amount just for those doors!

My code instead works like this: you create one door with that code and then just clone it.
And they form pairs by their cloneindexes, like 0 and 1, 2 and 3, 4 and 5, etc.
That means you don't have to write any code, or create any variables after creating one door / teleport
with that code of mine.

It's way more easier to use and actually much simpler than yours. :)

Re: How to? Need help "teleporting" an actor

PostPosted: Mon Feb 21, 2011 3:13 am
by bilvyy
again wrote:I made GED to help you its much simpler and its located here

viewtopic.php?f=2&t=10043


thank you for this, i'm just a little stuck getting the codes in order to make sure all the collisions work.

lcl wrote:
again wrote:I made GED to help you its much simpler and its located here

viewtopic.php?f=2&t=10043

Kren, yeah your code is easily understandable, but think of using it when there
is over hundreds of doors! I mean, you always have to create new actor and add those events to it
and even create one variable more. So, with 100 pairs of doors you would have 100 variables and it's awful
amount just for those doors!

My code instead works like this: you create one door with that code and then just clone it.
And they form pairs by their cloneindexes, like 0 and 1, 2 and 3, 4 and 5, etc.
That means you don't have to write any code, or create any variables after creating one door / teleport
with that code of mine.

It's way more easier to use and actually much simpler than yours. :)


your code would probably work if i understood it :/ i don't know how to work code really and i get mixed up with all the variables and i haven't a clue what cloneindexes are. i think i need a really dumbed down step-by-step tutorial to help me.

i've got 7 pairs of doors in my game, if that helps or matters at all.

Re: How to? Need help "teleporting" an actor

PostPosted: Wed Feb 23, 2011 7:09 am
by lcl
First, you create one actor that is door.
You have to create integer variable named canMove.
And then you add that code I made into door - collision any side of player, repeat: yes.
Then just clone 14 doors add them into the positions you want.
They work in pairs. (Cloneindex is the number after the cloned actors name).
They form pairs by their cloneindexes. Like door number 0 takes you to door number 1 and oppositely. Other pairs are 2 and 3, 4 and 5, etc.
In the code there is that KEY_UP. It means arrow key up.
You can change it to any key on keyboard, like KEY_x.
There is comments in the code, they explain it. And I uploaded a demo to the topic about that code. :D