Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / sprite moves with camera

Author
Message
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 21st Sep 2004 05:36
hello,
I may not be able to do this, but what I would like to is this.
I made a object plane and want to move the camera over the plane looking vert. down on it. I made a sprite and load it in to the program, it is there. As I move the camera around my object plane
the sprite move with the camera. I want it to stay where it was put.
well it does, I got it at 10,10 and it stay there. I want for it to stay where it is put on the plane. I know I trying to use a 2D sprite on a 3D plane. can it be done, if so how.

what I want to do is, the plane is a big battle field and I want for the camera to be able to move around the field at will and the sprites to be doing what they should be doing. not moving with the camera
here is the code I have now

sync on
sync rate 60
camx# = 130.0
camy# = 500.0
camz# = -137.0

autocam off
position camera camx#, camy#, camz#
point camera camx#, camy#, camz# : rem pointing straight down!
set ambient light 50
make light 1



make object plain 1,2000,2000
load image "cwbg2.bmp",1
texture object 1,1
do
if upkey() then inc camy#,1.0
if downkey() then dec camy#,1.0
if leftkey() then dec camx#,1.0
if rightkey() then inc camx#,1.0
if inkey$() = "a" then inc camy#,1.0
if inkey$() = "z" then dec camy#,1.0
if camx# > 800.0 then camx# = 800.0
if camx# < -800.0 then camx# = -800.0
if camy# > 913.0 then camy# = 913.0
if camy# < -900.0 then camy# = -900.0

`controls



sync


position camera camx#,camy#,camz#
loop

thank you renny
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Sep 2004 09:41
When you move the plain forwards, you move the sprite backwards, and vice-versa.

sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 22nd Sep 2004 09:15
Thank you, but that will not work as I am going have many sprites doing many things as I move around the battlefield with the camera. But thank you for your help pincho.
skovron
22
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 23rd Sep 2004 00:19
Well not 100% sure but sprites are 3D plains locked to camera so its keep their position relative to the camera.

Use textured plains instead of sprites and place them a little above the main plain and move those plains. In other case You have to do a little math so when camera moves along x axis say by 10 units then move all sprites -10 units. But I think It'll be very hard to find out correct camera, battlefield, plains positions and distances.

I hope I helped a liitle
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 23rd Sep 2004 00:58
thank you skovron, the plain ideal sound good. I should have came up with that. OOO will some time your maid does not work right. thanks
renny
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 24th Sep 2004 02:19
hi skovron,
So far your great ideal is working fine. Still have a lot to do.
renny

Login to post a reply

Server time is: 2026-06-11 17:34:13
Your offset time is: 2026-06-11 17:34:13