Hi,
I am trying to integrate some particle effects into our game.
I am using a table called "camera" with variables "x" and "y" to scroll a level in relation to the player. So, for instance, when I draw the player, it's drawn to player.x + camera.x and player.y + camera.y.
However, when I want to position a particle system on the player, I set it to player.x+camera.x, player.y+camera.y, and it works, but the particles themselves are not being drawn relative to the camera, like the emission point is. That is, I assume, because the particle emitter doesn't care about the camera.x and camera.y variables.
Is there a way that I can make this happen?
Thanks in advance.
Particles: Relative positioning?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Particles: Relative positioning?
Just to be extra clear, what I would like is to add the camera.x and the camera.y value to the x and y properties of every individual particle.
Re: Particles: Relative positioning?
Try it without camera.x and camera.y. It depends on the way you're drawing, but this could possibly fix it.
Re: Particles: Relative positioning?
I might see your point there, but how do I scroll through a level without adding an x and y value to every object?
- dreadkillz
- Party member
- Posts: 223
- Joined: Sun Mar 04, 2012 2:04 pm
- Location: USA
Re: Particles: Relative positioning?
You can transform your entire coordinate systems without changing their "world" coordinates. So your object could just be at point (x,y) and you draw your particles at (x,y) without adding all that camera.x,camera.y stuff. This is useful for scrolling and for making a camera system. See love.graphics.translate, love.graphics.scale, etc. https://love2d.org/wiki/love.graphics.translate
Re: Particles: Relative positioning?
oh. wow, that is so much easier
thanks a lot, mate
thanks a lot, mate
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Particles: Relative positioning?
Yeah, before I learned about love.graphics.translate() I used to add the level offset to each object. Translate made it so much easier and braindead simple. I felt silly. Live and learn!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 9 guests