Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: ShipAPI setSprite() lulz  (Read 1132 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
ShipAPI setSprite() lulz
« on: January 04, 2014, 10:30:48 AM »

Basically, setSprite causes some lulz when used.  I used setSprite() for the first time with a ShipAPI today, and found:

1.  If the ship has a center that isn't (0,0) then it gets displaced when setSprite() is called, even if the sprite is exactly the same number of pixels XY.  This causes some havoc if it's being called in the Refit context (which it'd sure be nice to be able to get for anything involving Sprite changes) and it looks weird in battles.

2.  I'm not sure if it's related or I just didn't notice before, but AOE weapons detonate within the bounds radius but not when their AOE would generate a valid point within the bounds, instead of checking if they're near enough to actually do any damage to the hull (most of the AOE for a really big, skinny ship like my Acanthus detonates harmlessly far away from the hull).
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: ShipAPI setSprite() lulz
« Reply #1 on: January 04, 2014, 11:45:12 AM »

1. You need to use ShipAPI.getSprite().setCenter() after setting the sprite if you don't want it to be in the middle. You can retrieve the original center with getSprite().getCenterX/Y().

2. Right, yeah. Just how that works, yet another part of the whole "the engine doesn't really handle long thin ships too well" bit.
Logged