Making a Straight Projectile in Different Directions

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

User avatar
Mogri
Super Slime
Posts: 4669
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Soule X wrote:Since you can't travel a fraction of a pixel
This is where your assumption is wrong. You can't display fractions of pixels, but you can absolutely store fractions in the code.

It's also odd that you think of a diagonal pixel as the same distance as a horizontal or vertical pixel. Look at it this way: if one object moves one pixel right and another moved one pixel right and one pixel up, did they both move one pixel? Or did the second move two pixels?
User avatar
Gizmog
Metal King Slime
Posts: 2622
Joined: Tue Feb 19, 2008 5:41 am

Post by Gizmog »

Moogle raises a good point, and it scales

You have a pixel that goes up+right, up+right

You have a second pixel that goes up,up,right,right.
User avatar
Soule X
Red Slime
Posts: 86
Joined: Wed Sep 19, 2012 4:18 pm
Location: Indianapolis

Post by Soule X »

This is where your assumption is wrong. You can't display fractions of pixels, but you can absolutely store fractions in the code.
Yes, I understand that. I meant visually the projectile won't move less than a pixel at a time. However...
It's also odd that you think of a diagonal pixel as the same distance as a horizontal or vertical pixel. Look at it this way: if one object moves one pixel right and another moved one pixel right and one pixel up, did they both move one pixel? Or did the second move two pixels?


Actually, neither, which is what TMC's point was. It would actually have traveled about 1.41 times the distance of the horizontal pixel. So yeah I guess it really does travel up to a 41% greater distance diagonally, however I think I want it to be that way. Visually and gameplay mechanics-wise I think it makes sense for it to reach the top right of the screen at the same time it takes to reach the middle right, at least in my case.

I just looked at one of my favorite games, Sunset Riders, to see if they slowed the diagonally travel bullets or not, and it doesn't appear so. In fact, when you have a powered up shot that simultaneously fires a horizontal and diagonal bullet they reach their destination at the exact same time. So I think it's more visually appealing in this instance.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I actually feel that with pixelated graphics diagonal movement somehow often doesn't appear (feel) faster.
Last edited by TMC on Tue Apr 28, 2015 3:07 pm, edited 1 time in total.
User avatar
spheroidal_defence
Red Slime
Posts: 25
Joined: Mon Aug 04, 2014 10:13 pm
Location: CCCP

Post by spheroidal_defence »

:o
reinterpret_cast<ClassB>(a);
User avatar
Soule X
Red Slime
Posts: 86
Joined: Wed Sep 19, 2012 4:18 pm
Location: Indianapolis

Post by Soule X »

I turned up the fps just for fun and when things are moving very fast you can tell the difference more easily for some reason.
Post Reply