gbadev
Game Boy Advance homebrew development forum
default profile picture

Bump

Member
Last seen 1 month ago
Joined:
Posts:
2
Topics:
1

Yes, thank you.

My Code:

#include "bn_core.h"
#include "bn_log.h"
#include "bn_sprite_ptr.h"
#include "bn_sprite_items_egg.h"

int window_x = 240;
int window_y = 160;

int main()
{
    bn::core::init();
    bn::sprite_ptr egg_sprite = bn::sprite_items::egg.create_sprite(0, 0);
    int direction = 1;
    int speed = 1;

    while (true)
    {
        // how to print egg_sprite.x()

        if ((egg_sprite.x() >= window_x / 2))
            direction = -1;
        else if (egg_sprite.x() <= -window_x / 2)
            direction = 1;

        egg_sprite.set_x(egg_sprite.x() + speed * direction);
        bn::core::update();
     }
}

I tried bn::log(egg_sprite.x()); but it gave me this error: no suitable user-defined conversion from "bn::fixed" (aka "bn::fixed_t<12>") to "const bn::istring_base" exists.
I checked out the logging example for butano, but I was so confused and couldn't understand the code.
Thank you.