particles and direction woes

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
trookat
Prole
Posts: 18
Joined: Sun Nov 14, 2010 12:32 pm
Location: Western Australia
Contact:

particles and direction woes

Post by trookat »

I need someone to take a look and point out what i am doing wrong

What is meant to happen. press direction arrow , moves ship in the desired direction , particles come out flowing to the opposite direction.

what happens, ship rotates incorrectly , particles flow in weird directions.
Attachments
test.love
(2.06 KiB) Downloaded 164 times
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: particles and direction woes

Post by Taehl »

Sounds to me like you've messed up some trigonometry (math.sin, math.cos, and the like). Sadly, I'm awful at math, so I doubt I could be of much assistance. So either play with that, or someone else will be along shortly to help.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: particles and direction woes

Post by Ellohir »

It's not a math thing. It's the way you store the angle information. You calculate the difference between previous and current "x" position and "y" position. The problem is, when you go only on the "x" position that "y differential" doesn't dissapear, so it keeps showing the ship and the particles as going diagonally. My suggestion is to widen your control "if" block with the 8 directions, turning each case into an "elseif".
User avatar
trookat
Prole
Posts: 18
Joined: Sun Nov 14, 2010 12:32 pm
Location: Western Australia
Contact:

Re: particles and direction woes

Post by trookat »

Ellohir wrote:It's not a math thing. It's the way you store the angle information. You calculate the difference between previous and current "x" position and "y" position. The problem is, when you go only on the "x" position that "y differential" doesn't dissapear, so it keeps showing the ship and the particles as going diagonally. My suggestion is to widen your control "if" block with the 8 directions, turning each case into an "elseif".

thanks i just worked it out just before rechecking the thread if your interested here is the fixed version
Attachments
test.love
(2.5 KiB) Downloaded 189 times
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: particles and direction woes

Post by Ellohir »

Nice job, control feels great now :awesome:
LiquidDandruff
Prole
Posts: 18
Joined: Fri Dec 16, 2011 11:29 pm

Re: particles and direction woes

Post by LiquidDandruff »

the particles look great!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot] and 7 guests