Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / background causing collision problems?

Author
Message
mahoon
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location:
Posted: 4th Oct 2008 01:18
I've just started at this, so am pretty green.

Have been working through the asteroids-type sprite game on DBPro vol1. All going lovely, even added a few bits here and there.

Decided to add a simple starfield as backdrop (plain black image with a few white dots). Added it with:

'load image "starfield.jpg",3
sprite 3,0,0,3
scale sprite 3,200'

and beefed it up to 200%

with this in my initialisegame() function, there's no detecting when my missiles hit the asteroids.

have set the missiles to sprite no 30, asteroids are loaded with:
'create animated sprite firstasteroid, "animspr.bmp",4,4,1'

and the spritehit number is set to 10:

'spritehit =sprite hit(spriteno,0)
if spritehit>10
delete sprite spritehit
delete sprite spriteno
post= spriteno-firstmissile
missilemoves(post)=0
else
post=spriteno-firstmissile
inc missilemoves(post)'


with the background remmed out, it all works fine - missiles hit and asteroids disappear.

Any suggestions would be welcome (have tried various orders of loading the images, to no avail).
Cheers.
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 4th Oct 2008 02:54
move the background out of the way before the collision check, and then move it back after the check
The collision check is probably detecting a collision with the background before an astroid, and so it ignores the astroid. Kinda annoying. You could right your own collision functions...


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
mahoon
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location:
Posted: 4th Oct 2008 11:24
It's an idea, and certainly the missiles were destroying the background when I had the image number set above the if spritehit>1 condition - however, I changed it so spritehit>10 and the background - as far I think these things work - is set to 3, so should be ignored...
mahoon
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location:
Posted: 4th Oct 2008 16:57
I'll give that a shot - thanks
azza87
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: UK
Posted: 7th Oct 2008 14:03 Edited at: 7th Oct 2008 22:09
I've been having this problem and have looked everywhere for a solution, and there it is! Thank you so much!

Login to post a reply

Server time is: 2024-11-25 16:39:27
Your offset time is: 2024-11-25 16:39:27