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 / Brick/Breakout collisions with array

Author
Message
Johnthesmith
14
Years of Service
User Offline
Joined: 16th Aug 2010
Location:
Posted: 16th Aug 2010 13:32
Basically, I can create a collision with 1 brick.

I can create many bricks to appear on screen.

However, I cannot do them both at the same time.

What am I doing wrong?

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Aug 2010 18:26 Edited at: 16th Aug 2010 18:27
I just skimmed over the code (not enough time). In the SPRITE HIT command if you use a zero for the target sprite instead of a specific sprite number it'll return the sprite number it's hitting. If it returns a zero it's not hitting anything.

Here's the syntax:

Return Integer=SPRITE HIT(Sprite Number, Target Sprite Number)

And the explanation:
If a target sprite has not been specified and a value of zero has been used, this command will return the sprite number of any sprite impacting against it. The parameters should be specified using integer values.

If you want to keep using specific sprite numbers in SPRITE HIT you only need to create a FOR/NEXT loop to go through each individual sprite.

Login to post a reply

Server time is: 2024-11-24 11:45:08
Your offset time is: 2024-11-24 11:45:08