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 / Bullet arrays and Sprite Hit

Author
Message
jack frost knight
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location:
Posted: 8th Sep 2013 10:53
I'm trying to get SPRITE HIT to return a value of 1 if a bullet hits a sprite, and if possible, return the given number of said sprite to be returned as well. I'm using an array to handle the Bullets.

I've tried putting "Bullets" , "Bullets(b,2)" "b", and "b+11" where (SPRITE NUMBER) of the SPRITE HIT command is supposed to go, but it keeps telling me that "sprites does not exist".







Here is the code:


Thanks in advance.

CPU: AMD Phenom II X4 3.2GHz Quad-core HD: 640GB(6GB/s) RAM: G.Skill 4GB (1600MHz) GPU: ATI Radeon 5870
MoBo: ASUS M4A88TD-V EVO OS: Win 7 Home 64-bit
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Sep 2013 05:04
Well for starters that code won't compile because you're missing until to match the repeat. Secondly, the sprite doesn't exist because you haven't created them anywhere. You create the array but not the sprites.

If you want to use sprites, then make a single sprite with the bullet image and then clone it.

Personally, I'd probably skip using sprite hit and just check the collision mathematically.

Here's a quick demo. Bullets are check for collision with the top of the screen. Once it hits the top, the bullet is killed.


Login to post a reply

Server time is: 2024-04-19 09:01:27
Your offset time is: 2024-04-19 09:01:27