Tiled wallpaper with Camera

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

Tiled wallpaper with Camera

Post by TheMeq »

I am using HUMP camera for a game, and I have the camera following a ship. I would like to add a starfield background. I have an image which is 512 x 512 which I would like to tile over the background, the only issue is, once the camera moves out of the area of the screen, the starfield will no longer appear.

I can get the camera position and need to figure out a way to make sure the star field appears within the camera's scope.

I need the stars to be snapped at multiples of 512.

So the first tile will be at 0,0 and this will need to apply to negative figures also, the tile should snap to -1024,-1024 and -1024,-512 ect;

How would I calculate where to draw the graphic? I figure there is going to be some hardcore math involve.
User avatar
TheMeq
Citizen
Posts: 56
Joined: Fri Sep 02, 2011 9:56 pm
Location: Nottingham, UK

Re: Tiled wallpaper with Camera

Post by TheMeq »

Managed to resolve this one :D
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 218 guests