Page 1 of 1

Making characters

PostPosted: Mon Oct 06, 2014 1:51 pm
by Jman123
Hi there everyone sorry to sound like a bit of a newbie at this but I am ! Just wondering how to create a character that can move that's all
Thanks

Re: Making characters

PostPosted: Mon Oct 06, 2014 2:50 pm
by rodot
You should look at the "basic/controls" example first, then at "intermediate/physics". These examples are provided with the gamebuino library.

Re: Making characters

PostPosted: Fri Oct 24, 2014 9:12 pm
by Sushi
First, declare your player position variables like so
Code: Select all
int player_x = 0;
int player_y = 0;

Then, create a bitmap for your character. You can use a bitmap or just create a square like this:
Code: Select all
int boxDim = 5;
gb.display.drawRect(boxDim,boxDim,player_x,player_y)

in the case of a bitmap, you can do this
Code: Select all
gb.display.drawBitmap(player_x,player_y,bitmap_name_goes_here)

don't forget to make sure your player_x and player_y variables change when you press the buttons
Code: Select all
if(gb.buttons.pressed(BTN_button_goes_here)){
    player_x_or_y = player_x_or_y + or - 1;
}