View Single Post
Seren

JCF Member

Joined: Feb 2010

Posts: 872

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Apr 27, 2025, 03:11 AM
Seren is offline
Reply With Quote
All jjDraw* functions take an optional playerID argument that can be used to specify which player the sprite should be drawn for (the default of -1 denoting all). This already enables patterns such as
Code:
void onDraw(jjOBJ@ obj) {
    for (int i = 0; i < jjLocalPlayerCount; i++) {
        const auto@ player = jjLocalPlayers[i];
        // draw the sprite facing the player's direction instead of the object's
        jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame,
                player.direction, playerID: player.playerID);
    }
}
The proposed overload couldn't really do anything more than move this loop outside of the function and into JJ2+ code - which we could do, but this use case comes up rarely enough that it would probably do more harm than good to provide a dedicated shorthand for it.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.