2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: reset player position & press any key
[Re: elevationmind]
#412441
11/27/12 14:12
11/27/12 14:12
|
Joined: Feb 2010
Posts: 320 TANA/Madagascar
3dgs_snake
Senior Member
|
Senior Member
Joined: Feb 2010
Posts: 320
TANA/Madagascar
|
Hi, 1 - Normaly you can teleport an entity using vec_set on its position. But that depends on the logic used in your game and without some more code, that's difficult for me to tell you how or why. 2 - It's key_any
|
|
|
Re: reset player position & press any key
[Re: Kartoffel]
#412457
11/27/12 16:09
11/27/12 16:09
|
Joined: Nov 2012
Posts: 18 Germany
elevationmind
OP
Newbie
|
OP
Newbie
Joined: Nov 2012
Posts: 18
Germany
|
Thx. I see I was blind:)! But it still doesn't work for me, when I set the vector, and player gets to the point, where he should be "teleported" the game crashes. Is there an other way to tell the game "put the player where he was at the beginning"?
Last edited by elevationmind; 11/27/12 16:10.
|
|
|
Re: reset player position & press any key
[Re: elevationmind]
#412460
11/27/12 16:13
11/27/12 16:13
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Then it might be advantageous to post the whole code so we can have a look at it...
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: reset player position & press any key
[Re: Uhrwerk]
#412461
11/27/12 16:22
11/27/12 16:22
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
Are you actually even using the pre-definied playerpointer? ^^ Writing to a not-initialized pointer isnt a good idea
Last edited by Ch40zzC0d3r; 11/27/12 16:23.
|
|
|
Re: reset player position & press any key
[Re: Ch40zzC0d3r]
#412462
11/27/12 16:33
11/27/12 16:33
|
Joined: Nov 2012
Posts: 18 Germany
elevationmind
OP
Newbie
|
OP
Newbie
Joined: Nov 2012
Posts: 18
Germany
|
Ok here are the relevant parts of the code:
while (ZL<6) // part of the main level function if ((camera.x > 5200) && (camera.y > 2160) && Zielerreicht == 0) { ZL +=1; // Levelzähler geht hoch speichern(); Zielerreicht = 1;
} // Am Ende des Levels angekommen if (Zielerreicht == 1) { restart();} }
function restart() { vec_set(player.x, vector(0,608,100)); var S1=0, S2=0, S3=0, S4=0, S5=0, S6=0, S7=0, S8=0, SL=0; var Z1=0, Z2=0, Z3=0, Z4=0, Z5=0, Z6=0, Z7=0, Z8=0, Zielerreicht = 0; }
And I took the action for the Player "walk" from the tutorial;) :
action wizard_walk() { camera_follow(me); while (1) { // state 1: walking //////////////////////////////////////////// // rotate the entity with the arrow keys my.pan += (key_cul-key_cur)*5*time_step;
//
// move the entity forward/backward with the arrow keys var distance = (key_cuu-key_cud)*25*time_step; // auf 5 zurückstellen, wenn programmierung fertig c_move(me, vector(distance,0,0), NULL, GLIDE);
// adjust entity to the ground height, using a downwards trace c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME | IGNORE_PASSABLE); my.z = 100; // always place player's feet on the ground wait (1); } }
So yes - I guess I didn't initialise the players position - he just starts there, where I set him on the map...
I would be really greatful for any help, as I am a total beginner...
|
|
|
|