Class Camera
- java.lang.Object
-
- greenfoot.World
-
- Camera
-
public class Camera extends greenfoot.World
This is the Camera class. It is the central part of the camera package as it runs the background world and displays the things on screen. It extends the World class. Camera is currently in development. Splitscreen support is planned and you will find some parts of code of that but it does not do anything yet.- Version:
- 0.2.1
- Author:
- RcCookie
-
-
Constructor Summary
Constructors Constructor Description Camera(int width, int height, int camNum, double scale, greenfoot.World world, int[] locX, int[] locY)
Constructs a new World of type Camera that displayes an area of the given size centered onto the given coordinatesCamera(int width, int height, int camNum, double scale, greenfoot.World world, greenfoot.Actor[] host)
Constructs a new World of type Camera that displayes an area of the given size following the given actor.Camera(greenfoot.World world, int locX, int locY)
Constructs a new World of type Camera that displayes an area of 600 time 400 pixels centered onto the given coordinatesCamera(greenfoot.World world, greenfoot.Actor host)
Constructs a new World of type Camera that displayes an area of 600 time 400 pixels of view range of the given world following the given actor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
act()
Runs the main world without showing it and displays the actors at their relative positions.Camera
lookAt(int[] locX, int[] locY)
Activates and returns a new Camera that looks at the given coordinates with the old amount of screens and based on old settings.Camera
lookAt(int locX, int locY)
Activates and returns a new Camera that looks at the given coordinates based on old settings.Camera
lookAt(greenfoot.Actor a)
Activates and returns a new Camera that looks at the given actor based on old settings.Camera
lookAt(greenfoot.Actor[] a)
Activates and return a new Camera that looks at the given actors in splitscreen with the old amount of screens and old settings.
-
-
-
Constructor Detail
-
Camera
public Camera(greenfoot.World world, greenfoot.Actor host)
Constructs a new World of type Camera that displayes an area of 600 time 400 pixels of view range of the given world following the given actor- Parameters:
world
- The world the camera should displayhost
- The actor the camera should follow
-
Camera
public Camera(greenfoot.World world, int locX, int locY)
Constructs a new World of type Camera that displayes an area of 600 time 400 pixels centered onto the given coordinates- Parameters:
world
- The world the camera should displaylocX
- The x position of the world the camera should look atlocY
- The y position of the world the camera should look at
-
Camera
public Camera(int width, int height, int camNum, double scale, greenfoot.World world, int[] locX, int[] locY)
Constructs a new World of type Camera that displayes an area of the given size centered onto the given coordinates- Parameters:
width
- The cameras screen widthheight
- The cameras screen heightcamNum
- WIP The number of cameras for splitscreen (Does nothing!)scale
- WIP the zoom that the camera shows objects withworld
- The world the camera should displaylocX
- The x position of the world the camera should look atlocY
- The y position of the world the camera should look at
-
Camera
public Camera(int width, int height, int camNum, double scale, greenfoot.World world, greenfoot.Actor[] host)
Constructs a new World of type Camera that displayes an area of the given size following the given actor.- Parameters:
width
- The cameras screen widthheight
- The cameras screen heightcamNum
- WIP The number of cameras for splitscreen (Does nothing!)scale
- WIP the zoom that the camera shows objects withworld
- The world the camera should displayhost
- WIP The actors each camera should follow (Only first is used!)
-
-
Method Detail
-
act
public void act()
Runs the main world without showing it and displays the actors at their relative positions.- Overrides:
act
in classgreenfoot.World
-
lookAt
public Camera lookAt(greenfoot.Actor a)
Activates and returns a new Camera that looks at the given actor based on old settings.- Parameters:
a
- The actor to look at- Returns:
- The new Camera
-
lookAt
public Camera lookAt(greenfoot.Actor[] a)
Activates and return a new Camera that looks at the given actors in splitscreen with the old amount of screens and old settings.- Parameters:
a
- The actors to look at- Returns:
- The new Camera
-
lookAt
public Camera lookAt(int locX, int locY)
Activates and returns a new Camera that looks at the given coordinates based on old settings.- Parameters:
locX
- The x-coordinate to look atlocY
- The y-coordinate to look at- Returns:
- The new camera
-
lookAt
public Camera lookAt(int[] locX, int[] locY)
Activates and returns a new Camera that looks at the given coordinates with the old amount of screens and based on old settings.- Parameters:
locX
- The x-coordinates to look atlocY
- The y-coordinates to look at- Returns:
- The new camera
-
-