Hey everyone,
I'm new to C programming in general and having a tough time passing data w/ setUserdata. Are there any tutorials out there on how to set this up properly? I'm getting all kinds of errors related to pointers and then when I fix them, it crashes.
Here's a sample of my code:
struct carData {
int yDiff;
};
static void updateEnemyCar(LCDSprite* s)
{
struct CarData* carDataLocal = (struct CarData*) pd->sprite->getUserdata(s);
int yDiff = carDataLocal->yDiff;
}
static LCDSprite* createEnemyCar(int xPos, int yPos)
{
int startingYDiff = abs(-280 - yPos);
struct CarData* carDataLocal;
carDataLocal->yDiff = startingYDiff;
pd->sprite->setUserdata(car, (void*) carDataLocal);
}
Thanks in advance,
Jeebs