It is currently Wed Jul 18, 2018 5:56 am

 All times are UTC - 7 hours

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: direction flag vs negative velocityPosted: Tue Nov 25, 2014 4:38 pm

Joined: Wed May 19, 2010 6:12 pm
Posts: 2712
I have a problem. I need to be able to perform character actions in both directions (left and right) so I'm using a direction flag to decide either to add or subtract velocity to an object position. The problem I have is when the player kicks a boss, in order to fall in the correct direction, it has to EOR direction flags and negate velocity if they're facing opposite directions. Anybody know of a way to fix this problem?

Top

 Post subject: Re: direction flag vs negative velocityPosted: Tue Nov 25, 2014 4:56 pm

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20258
Location: NE Indiana, USA (NTSC)

You need a direction flag to store which direction a player is facing even if standing still.

If you have to "EOR direction flags and negate velocity", then "EOR direction flags and negate velocity". You'll probably need to special case whether the player and enemy are facing same or opposite directions anyway so that you can animate the enemy properly whether kicked from the front or the back.

Negating a number can be done inline:
Code:
eor #\$FF
sec

This is in fact a special case of reverse subtraction:
Code:
; A := amount - A
eor #\$FF
sec

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC - 7 hours