Forum Topic: X and Y help

(102 views • 6 replies)

This topic is 1 page long.

<< < > >>
Questioning

andy70707

Reply To Post Reply & Quote

Posted at: 4/10/09 10:29 AM

andy70707 LIGHT LEVEL 22

Sign-Up: 09/30/07

Posts: 2,346

I am making a platform game, and I have different respawn points my code is this:

xval = new Array(96, 923, 120, 1155, 600);
_root.player._x=xval[random(xval.length)]
if(xval==96){
	yval=330
}
if(xval==923){
	yval=11
}
if(xval==120){
	yval=15
}
if(xval==1155){
	yval=637
}
if(xval==600){
	yval=635
}
_root.player._y=yval
_root.player.play()
_root.player.playing=true

and this all works, he dies, respawns, and you can move again. The noly problem is, since I am using a vcam, it seems to mess up all the x and y points, because the vcam is effectively the center of the stage. So it spawns in that position relative to where you died. So what do I do?

add me on xbox 360: CoD4 and CoD5 (and sometimes TF2) gamertag: andy70707

BBS Signature

None

Spikedit

Reply To Post Reply & Quote

Posted at: 4/10/09 10:46 AM

Spikedit NEUTRAL LEVEL 01

Sign-Up: 03/02/09

Posts: 41

At 4/10/09 10:29 AM, andy70707 wrote:
and this all works, he dies, respawns, and you can move again. The noly problem is, since I am using a vcam, it seems to mess up all the x and y points, because the vcam is effectively the center of the stage. So it spawns in that position relative to where you died. So what do I do?

I'm not sure exactly, but you are missing some ";"s in that code


None

51lver

Reply To Post Reply & Quote

Posted at: 4/10/09 10:55 AM

51lver EVIL LEVEL 21

Sign-Up: 01/14/08

Posts: 517

ummmm not exactly sure on what your problem is...you need to elaborate more on what you'd like to happen.....but the v-cam is NOT the centre of the stage...it simply moves the viewing area around.....so what you might see as the centre of the stage could actually be 100000 pixels to the right and 400000 pixels down....


None

andy70707

Reply To Post Reply & Quote

Posted at: 4/10/09 11:02 AM

andy70707 LIGHT LEVEL 22

Sign-Up: 09/30/07

Posts: 2,346

At 4/10/09 10:55 AM, 51lver wrote: ummmm not exactly sure on what your problem is...you need to elaborate more on what you'd like to happen.....but the v-cam is NOT the centre of the stage...it simply moves the viewing area around.....so what you might see as the centre of the stage could actually be 100000 pixels to the right and 400000 pixels down....

basically, I have some spawn positions set up, and each one is in a different place on the map. However, I have a vcam following the player, and when you die, you respawn. That works. Althoguh, say it was going to respawn at -200, 400. Thats 0,0 (normally the top left of the stage) minus -200 to the side and 400 down. This is what I want to happen. However, with the vcam, if you died at 1000, 300, it spawns at 800, 700, not -200, 400, where I want it to spawn. Also, you dont need ;'s in the code, it just helps organize it.

add me on xbox 360: CoD4 and CoD5 (and sometimes TF2) gamertag: andy70707

BBS Signature

None

Denvish

Reply To Post Reply & Quote

Posted at: 4/10/09 11:05 AM

Denvish DARK LEVEL 45

Sign-Up: 04/25/03

Posts: 16,238

Not too sure, but can't you just add or subtract the vcam _x or _y from the spawn point? That seems like it should place them at the correct positions

- - Flash - Music - Images - -

BBS Signature

None

Paranoia

Reply To Post Reply & Quote

Posted at: 4/10/09 11:09 AM

Paranoia DARK LEVEL 33

Sign-Up: 04/22/05

Posts: 9,692

Also I'd advise against using a V-Cam for your game. You'll make it a lot easier on yourself if you code your own scrolling.

BBS Signature

Elated

andy70707

Reply To Post Reply & Quote

Posted at: 4/10/09 11:20 AM

andy70707 LIGHT LEVEL 22

Sign-Up: 09/30/07

Posts: 2,346

At 4/10/09 11:05 AM, Denvish wrote: Not too sure, but can't you just add or subtract the vcam _x or _y from the spawn point? That seems like it should place them at the correct positions

Thanks denvish, I dont know why I didnt think of that!

add me on xbox 360: CoD4 and CoD5 (and sometimes TF2) gamertag: andy70707

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 06:59 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!