A question about doors

Non-platform specific questions.

A question about doors

Postby olly2000 » Fri Sep 17, 2010 5:59 pm

I try to create my first game with game editor and there 's one thing that I want to know: can I make a door without using the LoadVars variable. :?:
I don't want to use a lot of files.

Thank for answers
Am I the only one who speaks French here?
User avatar
olly2000
 
Posts: 25
Joined: Mon Aug 09, 2010 6:48 pm
Location: Canada,Quebec
Score: 1 Give a positive score

Re: A question about doors

Postby zxcvbnm » Fri Sep 17, 2010 11:56 pm

Yes you can make doors without using load vars. Do you have a demo of the project your working on ?
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: A question about doors

Postby savvy » Sat Sep 18, 2010 10:45 am

what sort of door? ive never used loadvars for doors :S
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: A question about doors

Postby DST » Sat Sep 18, 2010 6:14 pm

To make doors, is actually quite simple.

First you create the door, and start cloning it, then make a variable for player to enter door, and a variable to store the doornumber. Then arrange your doors so that they are sequential cloneindexes.
That is, door 0 and door 1 lead to each other, door 2 and door 3 lead to each other, etc. etc.

Player>Collision>Any Side>Door>
Code: Select all
doorvar=1;
doornum=collide.cloneindex;


player> collisionfinish>door>
Code: Select all
doorvar=0;


player>key down>up (or whatever key enters door){

Code: Select all
Actor*this;
int i;
int newdoornum;
if(doorvar==1){  //if player is touching a door
int i=doornum%2; //figure out even/odd door cloneindex
if(i==0){  //if door cloneindex is a multiple of 2 (0, 2, 4, 6, 8, etc etc)
newdoornum=doornum+1; }  //then get next door (0 leads to 1, 2 leads to 3)
else { //if door is not multiple of 2
newdoornum=doornum-1;} //then get previous door (1 leads to 0, 3 leads to 2)
this=getclone2("door", newdoornum);  //get the new door to warp to using getclone2
player.x=this->x;
player.y=this->y; //move to new door coordinates.
} //end if doorvar check.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest