Homebrew Sprite Animation bug

JDandy

Well-Known Member
Member
Joined
Sep 22, 2008
Messages
299
Trophies
0
Age
34
XP
84
Country
Netherlands
Your source code would be more helpful.
What are you using? PAlib?
If so, do you have the palette set properly? etc etc.

I don't think anyone can help you by looking at an .nds file
 

sleight

Well-Known Member
OP
Newcomer
Joined
Nov 23, 2008
Messages
73
Trophies
0
XP
63
Country
Gambia, The
JDandy said:
Your source code would be more helpful.
What are you using? PAlib?
If so, do you have the palette set properly? etc etc.

I don't think anyone can help you by looking at an .nds file

guess you're right ,but I was in hurry and it's not that much code..
..k here it is:

CODE#include
#include "gfx/all_gfx.c"
#include "gfx/all_gfx.h"
#include "loosey.h"


void newgame();

int main(int argc, char ** argv)
{
ÂÂÂÂÂÂÂÂPA_Init();
ÂÂÂÂÂÂÂÂPA_InitVBL();
ÂÂÂÂÂÂÂÂPA_InitSound();
ÂÂÂÂÂÂÂÂPA_InitText(0,0);
ÂÂÂÂÂÂÂÂPA_InitText(1,0);
ÂÂÂÂÂÂÂÂPA_LoadTiledBg(0,2,title_bottom);
ÂÂÂÂÂÂÂÂPA_LoadTiledBg(1, 3, title_top);
ÂÂÂÂÂÂÂÂPA_LoadSpritePal(0,0,(void*)title_Pal);
ÂÂÂÂÂÂÂÂPA_CreateSprite(0, 1,(void*)title_load_Sprite, OBJ_SIZE_64X32, 1, 0, 166, 90);
ÂÂÂÂÂÂÂÂPA_CreateSprite(0, 0,(void*)title_newgame_Sprite,OBJ_SIZE_64X32,1,0, 32, 90);
ÂÂÂÂÂÂÂÂPA_PlaySimpleSound(0, loosey);
ÂÂÂÂÂÂÂÂwhile (1)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (PA_SpriteTouched(0)) newgame();

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂPA_WaitForVBL();
ÂÂÂÂÂÂÂÂ}

ÂÂÂÂÂÂÂÂreturn 0;
}

void newgame()
{

ÂÂÂÂÂÂÂÂ//PA_DeleteSprite (0,1);
ÂÂÂÂÂÂÂÂPA_DeleteSprite (0,0);
ÂÂÂÂÂÂÂÂPA_EasyBgLoad(0,2,luminecrossing);
ÂÂÂÂÂÂÂÂPA_EasyBgLoad(1, 3,clouds1);
ÂÂÂÂÂÂÂÂPA_InitParallaxX(1,0,0,0,128);
ÂÂÂÂÂÂÂÂs32 scrollx = 150;
ÂÂÂÂÂÂÂÂs32 scrolly = 40;
ÂÂÂÂÂÂÂÂs32 scroll = 0;
ÂÂÂÂÂÂÂÂs32 x=100;
ÂÂÂÂÂÂÂÂs32 y=30;
ÂÂÂÂÂÂÂÂPA_LoadSpritePal(0,1,(void*)rin1_Pal);
ÂÂÂÂÂÂÂÂPA_CreateSprite(0, 2,(void*)rin_sprites1_Sprite, OBJ_SIZE_64X64,1, 1, 150, 64);


ÂÂÂÂÂÂÂÂwhile(1)ÂÂÂÂÂÂÂÂ {
ÂÂÂÂif(Pad.Newpress.Up) PA_StartSpriteAnim(0, 3, 4, 5, 6);
ÂÂÂÂif(Pad.Newpress.Down) PA_StartSpriteAnim(0, 6, 7, 8, 6);
ÂÂÂÂif(Pad.Newpress.Right) {
ÂÂÂÂÂÂÂÂPA_StartSpriteAnim(0, 2, 4, 7, 6);
ÂÂÂÂÂÂÂÂPA_SetSpriteHflip(0, 2, 1);
ÂÂÂÂ}
ÂÂÂÂif(Pad.Newpress.Left) {
ÂÂÂÂÂÂÂÂPA_StartSpriteAnim(0, 2, 4, 7, 6);
ÂÂÂÂÂÂÂÂPA_SetSpriteHflip(0, 2, 0);
ÂÂÂÂ}

ÂÂÂÂif(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_SpriteAnimPause(0, 2, 1);
ÂÂÂÂy += Pad.Held.Down - Pad.Held.Up;
ÂÂÂÂx += Pad.Held.Right - Pad.Held.Left;
ÂÂÂÂPA_SetSpriteXY(0, 2, x, y);

ÂÂÂÂPA_WaitForVBL();

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂscroll += 1;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂPA_ParallaxScrollX(1, -scroll);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂscrollx += (Pad.Held.Right - Pad.Held.Left)*4;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂscrolly += (Pad.Held.Down - Pad.Held.Up)*4;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂPA_EasyBgScrollXY(0,2,scrollx,scrolly);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂPA_WaitForVBL();
ÂÂÂÂÂÂÂÂ}

ÂÂÂÂÂÂÂÂreturn 0;};


I guess the palette is ok and sprite seems to be loaded correctly too... (i think so because i tried with another sprite first before designin my own and it worked fine)
 

JDandy

Well-Known Member
Member
Joined
Sep 22, 2008
Messages
299
Trophies
0
Age
34
XP
84
Country
Netherlands
Ok, having played it and taken a look at your code...

//PA_DeleteSprite (0,1); is commented out by the // (like you said), so it's normal that that Load sprite stays on screen.

There's this though:

if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 3, 4, 5, 6);
if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 6, 7, 8, 6);

I just took a look, and PA_StartSpriteAnim goes (screen, sprite, frame, frame, speed)
and your character sprite is number 2, so shouldn't it be;

if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 2, 4, 5, 6);
if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 2, 7, 8, 6);

?

I think that might be your solution; it only glitches the load sprite when walking up/down, after all.


Hope this solves it, it looks interesting!
Good luck.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • NinStar @ NinStar:
    on tiramisu you can access it by opening mii maker
  • crafthp434 @ crafthp434:
    okay
  • NinStar @ NinStar:
    I don't have a wii u anymore to test it myself, but if homebrews are not visible on the wii u menu I think you can press L + R + minus to open the plugin menu, there should be an option called "homebrews on wii u menu" or something similar
  • crafthp434 @ crafthp434:
    nope
  • crafthp434 @ crafthp434:
    it is L+dpad down+ select
  • crafthp434 @ crafthp434:
    but homebrew is appearing in the home menu btw
  • NinStar @ NinStar:
    yes, now I remember it
  • NinStar @ NinStar:
    then it is working, I also don't like that they did this but it is the only option you have if you are using aroma
  • crafthp434 @ crafthp434:
    i just didint know the homebrew launcher didint exist in aroma
  • crafthp434 @ crafthp434:
    thanks btw
  • Xdqwerty @ Xdqwerty:
    Im downloading fallout 3 goty edition
    +1
  • BigOnYa @ BigOnYa:
    I'm downloading more ram for my hamster pc
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    New hamster PC, with anal operation and BT connectivity!
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, How do I make enemies respawn on gdevelop after
    the player dies?
  • Psionic Roshambo @ Psionic Roshambo:
    Carrying a PC or phone is so old school!
  • Psionic Roshambo @ Psionic Roshambo:
    Squeeze your cheeks twice to answer calls!
  • BigOnYa @ BigOnYa:
    @Xdqwerty you can use a "spawner" function on any object.
    +1
  • BigOnYa @ BigOnYa:
    Or when your player dies, you can say in code, if enemy exists, do nothing, but if enemy does not exist, then create enemy at certain spot. (This would be a pain tho for lots of emeies)
    +1
  • BigOnYa @ BigOnYa:
    Easiest, simple way would be just restart scene, but player would restart from beginning.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, thx in advance
    +1
  • Spider2190 @ Spider2190:
    Heya
  • Spider2190 @ Spider2190:
    How are you doing, @Xdqwerty
    ?
  • Psionic Roshambo @ Psionic Roshambo:
    Dolphin porn??? This man has my vote!!! Lol
    Psionic Roshambo @ Psionic Roshambo: Dolphin porn??? This man has my vote!!! Lol