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.

2D All the way! / sprite hit

Author
Message
warship45
21
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 6th Sep 2004 00:31
hi
I am making a space invaders game using sprites.
As my ship is not a square or rectangle when the
invading ship fire at me my ship will be destroyed
before it hits me because it hits the box around the
ship and not the ship it self if you get what I mean.
I need to know how to fix this or get round this
Problem. i have tryed other programs but none of them
can save an image not as a square or rectangle.

go to http:\\bws.bizhat.com
Zone Chicken
22
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 6th Sep 2004 00:52
If your using pro per pixle collision doesn't work so calling sprite hit is exactly like calling sprite collision, the best thing to do is crop your image down as close as you can to your ship if your still having the same problem then make some little boxes and place them over your ship just at edges and make them transparent and of course move with your ship, then just call the collision on the boxes. This will work but can grow into some confusion very quickly make sure you lable every well so you know whats going on.
warship45
21
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 6th Sep 2004 01:00
i do not understand what you mean and is there an better way of doing it

go to http:\\bws.bizhat.com
Zone Chicken
22
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 6th Sep 2004 01:26 Edited at: 6th Sep 2004 01:46
ok give me a chance to show off my 3 min paint skills
anyways this is what you have when you make a sprite
mind you this is just a example.

the black area around your sprite will be invisible when you use the set sprite 1,1,1 command however the collision when you call collision hit is on the outer like this.

course you don't want that cause the missle will blow up 2 inches away from your ship so you make black boxes in paint just the size you need to fill your ship and then place them over your ship sorta like this then after there in place and working just make them transparent so they cant be seen.

try to make one box that is a good size to use for the whole ship sometimes it will take more however, but in the crappy pic here the one box could be rotated and used for two different collision it won't be exactly perfect but it's the only way to get collision relatively close that i know of. If someone else has another way i'd also like to know cause it would save me alot of time. something like this

`load and place ship
load image "media/ship.bmp",1
sprite 1,300,300,1
set sprite 1,1,1
`load and place horizontal collision box scb = ship collision box
load image "media/scb.bmp",2
sprite 2,300,280,2
set sprite 2,1,1
`places the verticle collision box scb
sprite 3,300,280,2
rotate sprite 3,90
`loads missle
load image "media/missle.bmp",3
sprite 4,0,300,3

do

`checks collision on the missle and the ship collision boxes
if sprite hit (4,3) = 1 ship blows up
if sprite hit (4,2) = 1 ship blows up

loop
warship45
21
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 6th Sep 2004 01:56 Edited at: 6th Sep 2004 02:36
thanks for that i will use that on all of them now
until i can find a better away

go to http:\\bws.bizhat.com
Dot Merix
22
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 6th Sep 2004 11:20
On one of the upcoming(not sure which one) upgrades for dark basic professional, they are adding free pixel perfect collision for 2d sprites.

Just cross your fingers it's soon!

- Merix

Athlon xp 2400+, 1.0GB Ram, Radeon 9800PRO 128mb
warship45
21
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 6th Sep 2004 22:36
thanks for that info i do hope that it comes out soon

go to http:\\bws.bizhat.com
warship45
21
Years of Service
User Offline
Joined: 24th Jul 2004
Location: uk
Posted: 6th Sep 2004 22:38
hi
thanks for that info i hope that it comes out soon.
is that the only way to get it to work at the moment
or is there another way.

go to http:\\bws.bizhat.com
heartbone
23
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 9th Sep 2004 12:36
If that's true then that's the first reason that I've seen that would make me upgrade my patch 4 DBP install.

Peace, the anti-Bush.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 10th Sep 2004 00:39
Yeah it's true! It am going to buy DBPro when that happens!!!

At last!!!

Login to post a reply

Server time is: 2026-06-11 17:33:14
Your offset time is: 2026-06-11 17:33:14