Sprites in MSX-C

صفحة 4/8
1 | 2 | 3 | | 5 | 6 | 7 | 8

بواسطة Wolverine_nl

Paragon (1159)

صورة Wolverine_nl

23-04-2014, 03:13

I got it to work, playercontrols work,
I also managed to put an enemysprite on there, that one isnt moving yet, some loop in the function stalls the rest, so disabled it for the moment.

Does anybody have any advise on spritecollisions?

بواسطة Daemos

Paragon (1958)

صورة Daemos

23-04-2014, 10:39

Quote:

Does anybody have any advise on spritecollisions?

If your sprites are objects with defined x and y coordinates you can try the following.

If your sprites are build up from single sprites you can use the VDP to poll for sprite collision. This will speeden up things a little.

Otherwise per each frame you just check and compare the xy coordinates of each object. so you start with object 1 then compare xy for object 2, 3, 4, etc then continue with object 2 etc etc.

بواسطة Wolverine_nl

Paragon (1159)

صورة Wolverine_nl

23-04-2014, 10:52

@ Daemos
I got vpeek and vpoke in the graphics library, also a bunch of write to vdp , read from vdp etc, somewhere should be possible Tongue Best is to just poll a vdp address which can give me the true or false?
I've never done sprite collisions before (maybe years ago in basic lol)

I was already happy with smooth scrolling multicolorsprites in MSX-C haha.

Seriously, why is figuring stuff out on MSX still fun?? I am happy with the smallest victory Smile

بواسطة Daemos

Paragon (1958)

صورة Daemos

23-04-2014, 11:50

Quote:

Seriously, why is figuring stuff out on MSX still fun?? I am happy with the smallest victory Smile

Thats the exact reason I am developing for MSX. Smile

بواسطة Wolverine_nl

Paragon (1159)

صورة Wolverine_nl

23-04-2014, 13:19

Nostalgia, combined with curiousity does allot.
I am glad i started again a while back.
Tonite i will attempt the collision thing.

بواسطة Grauw

Ascended (10313)

صورة Grauw

23-04-2014, 13:22

I don’t have much experience with sprites myself, but I read not too long ago that most people just do the sprite collision detection manually in code (by comparing x/y coordinates) because the VDP collision is a bit limited and doesn’t work well if you use flickering to show more than 5/8 sprites on a line.

بواسطة TheSpecialist

Expert (113)

صورة TheSpecialist

23-04-2014, 13:37

On MSX2 the VDP will tell you the coordinates of the collision. That makes it more useful for some game types.

بواسطة Wolverine_nl

Paragon (1159)

صورة Wolverine_nl

23-04-2014, 13:44

Yup, it seems I have to do it manually indeed Grauw Wink
@TheSpecialist
Thanks, I will see what i get back, will grab my VDP book lateron to check where to look for the collision data.

بواسطة TheSpecialist

Expert (113)

صورة TheSpecialist

23-04-2014, 13:47

It's reported in some status registers. You can also mark sprites as not participating in the hardware collision with a bit in the sprite attribute table.

بواسطة jlemos

Resident (58)

صورة jlemos

24-04-2014, 04:50

Hi Wolverine_nl.

Use the below code in your C program.

char vdpvalue = 0;
char *STATFL = (char *)0xF3e7;

vdpvalue = *STATFL & 32;

if (vdpvalue > 0)
{
/* Collision - Paint box red */
boxfill(0, 0, 32, 32, (char) 8, (char) 0);
}
else
{
/* Not Collision - Paint box white */
boxfill(0, 0, 32, 32, (char) 15, (char) 0);
}

Best regards,

Julio Lemos

صفحة 4/8
1 | 2 | 3 | | 5 | 6 | 7 | 8