Euflorium: The Eufloria Community

Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: Tomfloria on May 08, 2012, 01:26:53 AM

Title: Fully Restrict Camera Movement and Zoom - By the player
Post by: Tomfloria on May 08, 2012, 01:26:53 AM
I would like to do this, completely restrict the Position and Zoom from the user?

Mainly because say I put SetCameraPosition(0,0) then move the screen somewhere else and then later on the code is SetCameraPosition(100,0) it won't actually go to (100,0), it will go somewhere else depending on where I move the screen, I'm guessing it's not actually coordinates? but how far to move on the x,y position?
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: Pilchard123 on May 08, 2012, 02:13:58 AM
Try using

Code: [Select]

x = 0
y = 0

while GameRunning() do

    SetCameraPosition(x,y)

end

When you want to change the position of the camera, then change the values of the variables x and y. It will make your code a lot easier to manage and you may not get the bug I think you are having.
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: Tomfloria on May 08, 2012, 03:49:39 AM
What about if I wanted to give the user the option to move around and that later?
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: Pilchard123 on May 08, 2012, 04:26:39 AM
Then put the SetCameraPosition inside an if statement.

Code: [Select]

x = 0
y = 0
cameraRestricted = true

while GameRunning() do
    if cameraRestricted then
        SetCameraPosition(x,y)
    end
end

Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: Tomfloria on May 08, 2012, 04:58:40 AM
thanks :) ill add that in later and get back to you!
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: Tomfloria on May 08, 2012, 07:05:38 AM
That doesn't seem to work at all
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: annikk.exe on May 08, 2012, 06:20:11 PM
What happens when you try?

You're putting this code inside function LevelLogic, right?  It won't work if you put it inside LevelSetup.

Also, it's missing a couroutine.yield()
It should be this:

Code: [Select]
function LevelLogic()
x = 0
y = 0
cameraRestricted = true

while GameRunning() do
if cameraRestricted then
SetCameraPosition(x,y)
end
coroutine.yield()
end
end
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: annikk.exe on May 08, 2012, 06:22:17 PM
If you want to restrict the zoom too, use something like this:


Code: [Select]
function LevelLogic()
x = 0
y = 0
cameraRestricted = true
ZoomAmount = 5

while GameRunning() do
if cameraRestricted then
SetCameraPosition(x,y)
SetCameraZoom(ZoomAmount)
end
coroutine.yield()
end
end
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: Tomfloria on May 09, 2012, 12:08:15 AM
It will doesn't work Annikk, It must be an iPad limitation.
Title: Re: Fully Restrict Camera Movement and Zoom - By the player
Post by: annikk.exe on May 14, 2012, 11:54:45 PM
If you try loading up the level Extreme Pwn Laz0rs, that should restrict your view.  Try zooming out.  You might notice during the first minute, the amount you can zoom out is gradually increasing.  Do you get that on your iPad?  If so, what you are trying to do is possible after all. :>