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?
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.
@ 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 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
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.
Nostalgia, combined with curiousity does allot.
I am glad i started again a while back.
Tonite i will attempt the collision thing.
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.
On MSX2 the VDP will tell you the coordinates of the collision. That makes it more useful for some game types.
Yup, it seems I have to do it manually indeed Grauw
@TheSpecialist
Thanks, I will see what i get back, will grab my VDP book lateron to check where to look for the collision data.
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.
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