How to teleport demo

Non-platform specific questions.

How to teleport demo

Postby again » Wed Feb 16, 2011 2:49 am

I saw someone ask a question on how to teleport without using the moveto command. Without moveto its a little more complicated but its smooth and instant.Here is a simple demo demostrating teleportation smoothly.
Attachments
Untitled.zip
(21.33 KiB) Downloaded 131 times
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Re: How to teleport demo

Postby bilvyy » Mon Feb 21, 2011 3:27 am

thank you for this (:

if there is an easier way with moveto then that would be great; i just didn't know how to use it and assumed it was the wrong option for what i wanted to achieve.

with this demo, when i try to enter the code

Code: Select all
DestroyActor("Event Actor");

leftappear=1;


into the script editor, it always tells me there is an error, something to do with const int. i'm not sure what it is i need to fix.
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: How to teleport demo

Postby again » Mon Feb 21, 2011 4:31 am

bilvyy wrote:thank you for this (:

if there is an easier way with moveto then that would be great; i just didn't know how to use it and assumed it was the wrong option for what i wanted to achieve.

with this demo, when i try to enter the code

Code: Select all
DestroyActor("Event Actor");

leftappear=1;


into the script editor, it always tells me there is an error, something to do with const int. i'm not sure what it is i need to fix.


Ok you have to declare the variable leftappear . Do you know how to declare variables yet? I can explain if you need me too.
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Re: How to teleport demo

Postby nthl0gik » Mon Feb 21, 2011 9:01 pm

i've decided to try my luck with the ye olde teleport demo.... if anyone would be interested ? enclosed with this post is the goods, enjoy! oh btw let me know if it doesn't work right. i've tested it for errors and everything seems to check out aight when in game mode, however, just in case let me know.
Attachments
teleport 101.zip
enjoy!!
(4.6 KiB) Downloaded 129 times
User avatar
nthl0gik
 
Posts: 11
Joined: Fri Jan 28, 2011 6:24 pm
Score: 0 Give a positive score

Re: How to teleport demo

Postby AnarchCassius » Mon Feb 21, 2011 10:43 pm

I've modified blivvy's demo so it doesn't use variables but simply moves the player to near the paired door, similar to nthl0gik's method but with pair portals. This method is not the most efficient but very simple. You will need to remember which door leads to which and adjust the x and/or y values a bit for where you character should come out. The code should be pretty portable just make sure you change doorx to whatever the name of the actor your moving to is going to be.
Attachments
tele.rar
(76.69 KiB) Downloaded 109 times
AnarchCassius
 
Posts: 55
Joined: Sat Jan 29, 2011 1:33 am
Score: 6 Give a positive score

Re: How to teleport demo

Postby bilvyy » Wed Feb 23, 2011 12:31 am

again wrote:Ok you have to declare the variable leftappear . Do you know how to declare variables yet? I can explain if you need me too.

if you could explain variables, that would be great. i think that's the part which is making this difficult for me.
EDIT: Okay, i had a go in the global script and i think i managed to declare the leftappear variable. when my character walks through the door, he appears at the other door where i want him to! so that's great. the only problem is.. the view doesn't move with him.

AnarchCassius wrote:I've modified blivvy's demo so it doesn't use variables but simply moves the player to near the paired door, similar to nthl0gik's method but with pair portals. This method is not the most efficient but very simple. You will need to remember which door leads to which and adjust the x and/or y values a bit for where you character should come out. The code should be pretty portable just make sure you change doorx to whatever the name of the actor your moving to is going to be.

thank you for this, but unfortunately i've been doing this work on a school computer and there isn't a program that allows me to extract rar files. i'll have to check it out another day.

nthl0gik wrote:i've decided to try my luck with the ye olde teleport demo.... if anyone would be interested ? enclosed with this post is the goods, enjoy! oh btw let me know if it doesn't work right. i've tested it for errors and everything seems to check out aight when in game mode, however, just in case let me know.

unfortunately when i try to open this .ged in game editor i just receive an error message saying it can't open the data
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: How to teleport demo

Postby again » Wed Feb 23, 2011 12:44 am

Ok the make the view follow the actor.

Click on view
There is a selection that says parent click on the space to the right of parent.
Select the name of your charactor as your parent.
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Re: How to teleport demo

Postby bilvyy » Wed Feb 23, 2011 1:18 am

again wrote:Ok the make the view follow the actor.

Click on view
There is a selection that says parent click on the space to the right of parent.
Select the name of your charactor as your parent.


i've already done that :/ i did that when i first made the character.
the problem is that it's been following him fine, but it just won't move to his new location when he teleports through the doorway.
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: How to teleport demo

Postby again » Wed Feb 23, 2011 4:15 am

Ok remove the player as parent from the view.Change it so the view has no parent and put this magic code in the draw actor of the view.Now run the game!!!!


Code: Select all
x=player.x-80


If you dont like where the view fixes on the player player with the -80 you can change it too -100 and so forth. Let me know if you need anymore help.
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Re: How to teleport demo

Postby lcl » Wed Feb 23, 2011 7:15 am

For making the player alway be in the middle of view do this:
View - draw actor - script editor:
Code: Select all
x = player.x - width/2;
y = player.y - height/2;

Now it will work without you needing to change any numbers at all! :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: How to teleport demo

Postby again » Wed Feb 23, 2011 4:43 pm

lcl wrote:For making the player alway be in the middle of view do this:
View - draw actor - script editor:
Code: Select all
x = player.x - width/2;
y = player.y - height/2;

Now it will work without you needing to change any numbers at all! :D


Excellent!!!
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Re: How to teleport demo

Postby bilvyy » Wed Feb 23, 2011 10:57 pm

lcl wrote:For making the player alway be in the middle of view do this:
View - draw actor - script editor:
Code: Select all
x = player.x - width/2;
y = player.y - height/2;

Now it will work without you needing to change any numbers at all! :D

thank you so much!! it works perfectly!! :D

EDIT: using this code also solved a problem i was having with the visibility of a health bar on screen. so, thank you again!! i'm so happy now, so many problems i was having are now getting fixed (:
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: How to teleport demo

Postby again » Thu Feb 24, 2011 12:05 am

No problem we look forward to helping you make the best game possible.
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Re: How to teleport demo

Postby bilvyy » Thu Feb 24, 2011 12:18 am

Thank you (: I do have another question though, about the doors.

I want to be able to walk back through my doors. So if I go from city > zoo, i want to be able to go back from zoo > city by using the same door. I tried pasting the same code again but when my character walks back through the door, the view just jumps around and the character disappears somewhere, so I assume there's a problem with the code. Do i need to adjust any numbers/anything in the script?

EDIT: and what do i need to adjust in the code in order to make a new pair of doors?

Sorry for all the questions but i really appreciate all the help.
bilvyy
 
Posts: 23
Joined: Wed Feb 16, 2011 2:04 am
Score: 0 Give a positive score

Re: How to teleport demo

Postby again » Thu Feb 24, 2011 1:29 am

Ok no using this code you cannot go back through the same door without using a more complex method. But I will teach you how to make doors so you know exactly whats going on with the code.

Ok now I want you to open the GED as I will go step by step and explain the code :D

Now click on the player/ click on edit/ click on collision on door 4 .

Code: Select all
You see DestroyActor("Event Actor")

leftappear=1;


Now the destroy actor part destroy"s the actor you control. Now the leftappear=1 means you activated the variable leftappear 1 time.

Now go to the door 2 / click on edit / click on draw actor and you will see this code.

Code: Select all
if(leftappear==1)
{
CreateActor("player","mage"[,(none),(none),0,0)
leftappear=0;
}


if(leftappear==1) = that means if the variable leftappear=1 , then that triggers the code contain inbetween {} brackets

CreateActor means the player will be recreated at this spot.

Leftappear=0; = this means the variable leftappear will now be reset to 0. If you forget to reset the variable then the door will keep creating your player over and over again.

Ok I hope this helps you understand what is going on with the code. So now you can make any door you want.
1st declare the variable then use this guide I made to make doors. If you need further help just let me know.
Free windows mobile games like doodle jump and super mario bros
http://krenisis.freeforums.org/
again
 
Posts: 258
Joined: Wed Jan 19, 2011 7:06 pm
Score: 33 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest