Project - Mega Dracula - Help / Updates
Moderator: Stef
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
Re: Project - Mega Dracula - Help / Updates
Check your declarations. Do they have the same names as in the resource file? Are they the correct type?
Re: Project - Mega Dracula - Help / Updates
Yup all work normal it's only since I tried to pass them to a function did they not work they not work
That should work shouldn't it ???
Code: Select all
void animateEnemy(Sprite headSprite, Sprite bodySprite)
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
Re: Project - Mega Dracula - Help / Updates
Oh I just noticed. The function parameters are sprites when you need sprite definitions.
And you should pass them as pointers too.
And you should pass them as pointers too.
Re: Project - Mega Dracula - Help / Updates
Do you know how I'd play a sprite once forwards and then in reverse?
I've an 8 frame sprite and rather than use double the amount of frames I figured I could probably reverse the animation but I can't see a function to do it?
I've an 8 frame sprite and rather than use double the amount of frames I figured I could probably reverse the animation but I can't see a function to do it?
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
Re: Project - Mega Dracula - Help / Updates
You need a counter per animated object that tells which frame to show. If you want the animation to go forward then you increment the counter. If the animation goes backward then you decrement the counter.
I don't think there's a function to do it. You'll have to manage that on your own.
I don't think there's a function to do it. You'll have to manage that on your own.
Re: Project - Mega Dracula - Help / Updates
I'm trying to do a fade using:
and
My code however doesn't work!
Code: Select all
void VDP_fadeOut(u16 fromcol, u16 tocol, u16 numframe, u8 async);
Code: Select all
u16 VDP_isDoingFade();
Code: Select all
if (Dead == 0) {
VDP_fadeOut(32, 47, 20, TRUE);
if (VDP_isDoingFade == FALSE) {
SPR_clear();
drawnSprite = 0;
SubStageInt = 2;
}
}
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Project - Mega Dracula - Help / Updates
I don't understand what you expect from this piece of code :
Actually VDP_isDoingFade() will always return TRUE as you just started a asynchronous fade process just before.
Code: Select all
if (Dead == 0) {
VDP_fadeOut(32, 47, 20, TRUE);
if (VDP_isDoingFade == FALSE) {
SPR_clear();
drawnSprite = 0;
SubStageInt = 2;
}
}
Re: Project - Mega Dracula - Help / Updates
So if it was set to false would that code work? I thought calling VDP_isDoingFade would tell me when the fade is finished?
-
- Very interested
- Posts: 117
- Joined: Sun Jan 02, 2011 9:14 pm
- Contact:
Re: Project - Mega Dracula - Help / Updates
Code: Select all
if (Dead == 0) { VDP_fadeOut(32, 47, 20, TRUE); if (VDP_isDoingFade == FALSE) { SPR_clear(); drawnSprite = 0; SubStageInt = 2; } }
Code: Select all
if (Dead == 0) {
VDP_fadeOut(32, 47, 20, FALSE);
SPR_clear();
drawnSprite = 0;
SubStageInt = 2;
}
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Project - Mega Dracula - Help / Updates
Exactly... You should not use async fade if you want to wait for fade execution before doing something else
Re: Project - Mega Dracula - Help / Updates
question the random function is a u16 but all the maths functions are fix16 :/ So how do I do maths with a random number? Is there a way to convert the u16 to fix16? I can only see Int to fix16.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Project - Mega Dracula - Help / Updates
You can just use the random method to produce a random fix16 number. they have the same size so that doesn't make any difference
Re: Project - Mega Dracula - Help / Updates
Noticing a few bugs with sprites not sure if it's to do with how I call and play them.
Anyhow here is an updated video of my progress:
https://youtu.be/RXl1tiM3M0w
Anyhow here is an updated video of my progress:
https://youtu.be/RXl1tiM3M0w
Re: Project - Mega Dracula - Help / Updates
Stef does strclr clear chars completely? The following example strclr(tempTextline) doesn't seem to be working?
Code: Select all
#include <genesis.h>
struct ScreenMessages
{
char line1[36];
char line2[36];
char line3[36];
};
u16 displayOnScreenMessages(struct ScreenMessages Messages);
u16 increment = 0;
u16 ind;
u16 stage = 0;
u16 textStage = 0;
u16 timerSeconds = 500;
u16 timer = 0;
char tempTextline[36];
struct ScreenMessages Messages;
int main()
{
// disable interrupt when accessing VDP
SYS_disableInts();
// initialization
VDP_setScreenWidth320();
// VDP process done, we can re enable interrupts
SYS_enableInts();
ind = TILE_USERINDEX;
while(TRUE)
{
switch (stage) {
case 0:
strcpy(Messages.line1, "1 2 3 4 5 6 7 8 9 10 11 12 13 15 16");
strcpy(Messages.line2, "17 18 19 20 21 22");
strcpy(Messages.line3, "23 24 25");
stage++;
break;
case 1:
if (displayOnScreenMessages(Messages) == TRUE) {
stage++;
}
break;
case 2:
VDP_drawText("Complete!", 14, 10);
stage++;
break;
}
}
return 0;
}
u16 displayOnScreenMessages(struct ScreenMessages Messages) {
char character[0];
u16 complete = FALSE;
switch(textStage) {
case 0:
increment = 0;
timer = 0;
strclr(tempTextline);
strcpy(tempTextline, Messages.line1);
textStage++;
break;
case 1:
if (timer == 0) {
if (increment <= sizeof(tempTextline)) {
character[0] = tempTextline[increment];
VDP_drawText(character, 2+increment, 23);
strclr(character);
timer = timerSeconds;
VDP_drawText(tempTextline, 2, 2);
increment++;
} else {
textStage++;
}
} else if (timer > 0) {
timer--;
}
break;
case 2:
increment = 0;
timer = 0;
strclr(tempTextline);
strcpy(tempTextline, Messages.line2);
textStage++;
break;
case 3:
if (timer == 0) {
if (increment <= sizeof(tempTextline)) {
character[0] = tempTextline[increment];
VDP_drawText(character, 2+increment, 24);
strclr(character);
timer = timerSeconds;
VDP_drawText(tempTextline, 2, 2);
increment++;
} else {
textStage++;
}
} else if (timer > 0) {
timer--;
}
break;
case 4:
increment = 0;
timer = 0;
strclr(tempTextline);
strcpy(tempTextline, Messages.line3);
textStage++;
break;
case 5:
if (timer == 0) {
if (increment <= sizeof(tempTextline)) {
character[0] = tempTextline[increment];
VDP_drawText(character, 2+increment, 25);
strclr(character);
timer = timerSeconds;
VDP_drawText(tempTextline, 2, 2);
increment++;
} else {
textStage = 0;
complete = TRUE;
}
} else if (timer > 0) {
timer--;
}
break;
}
return complete;
}
Re: Project - Mega Dracula - Help / Updates
IS this how to enable a sprite?
Also I'm using this code to write on screen text however I'm getting artifacts it only seems to happen after I load and animate a sprite.
In the image notice the weird L shaped pixels at the end!
Code: Select all
VDP_setPalette(PAL3, ghoul_sprite.palette->data);
SPR_initSprite(&sprites[0], (SpriteDefinition*)&ghoul_sprite, EnemySpriteXInt, EnemySpriteYInt+40, TILE_ATTR(PAL3, TRUE, FALSE, FALSE));
Also I'm using this code to write on screen text however I'm getting artifacts it only seems to happen after I load and animate a sprite.
Code: Select all
u16 writeOnScreenMessage(char message[], u16 messageRow) {
u16 completeOnScreenMessage = FALSE;
char character[0];
u16 stringLength = strlen(message) - 1;
if (timer == 0) {
if (increment <= stringLength) {
character[0] = message[increment];
VDP_drawText(character, 2+increment, messageRow);
strclr(character);
timer = timerSeconds;
increment++;
completeOnScreenMessage = FALSE;
} else {
timer = 0;
increment = 0;
completeOnScreenMessage = TRUE;
}
} else if (timer > 0) {
timer--;
completeOnScreenMessage = FALSE;
}
return completeOnScreenMessage;
}