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.

AppGameKit Classic Chat / Sprite Collision

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Mar 2014 15:59
Hello Guys.

I want my bullet after fire collide with a another sprite and destroy my bullet. Now I Need 2 thing, one how can destroy a bullet after collide with another sprite and second I use this code for check collide with 2 sprite but don't work.



Please guide Me.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 22nd Mar 2014 16:25
You need to do an array of bullet fired, and when a bullet hit a sprite you need to delete the N bullet sprite that collide.
The array must contain the ID of the bullet.

Long life to Steve!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Mar 2014 16:37
Quote: "
You need to do an array of bullet fired, and when a bullet hit a sprite you need to delete the N bullet sprite that collide.
The array must contain the ID of the bullet.
"


I don't work with array could you give me a sample?

Thanks
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 22nd Mar 2014 18:04 Edited at: 22nd Mar 2014 18:05
Well....

If player 1 shot 3 bullets...

bullet[0].x
bullet[0].y
bullet[0].id_sprite

bullet[...].....

for i = 0 to count(bullet)
if(getspritecollision(bullet[i].id_sprite, enemy) then delete bullet[i].id_sprite
Here of course you need to delete it from the array
next i

If you don't use array is very hard you can complete a bullet demo
Or if you want only to do a test
Use 1 bullet and 1 enemy and cycle the collision in the loop, when it' s true delete the bullet and the enemy.

Are you using Tier 1 i suppose... better you wait someone use basic as i use c++

Long life to Steve!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 22nd Mar 2014 19:09
Thanks xGEKKOx.

Quote: "
better you wait someone use basic as i use c++
"


I wait for anyone give me basic code.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Mar 2014 20:54
i made a example for you, its without physics.


AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
blastar
11
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 22nd Mar 2014 21:12 Edited at: 22nd Mar 2014 21:17
here is another small arcade-like demogame: how many shots you need to kill all enemies.(LEFT/RIGHT/SPACE)
it is not commented, but splitted into small and easy-to-understand parts.

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 23rd Mar 2014 14:30
Thanks Markus
Thanks blastar

but really for create bullet need This is all the code?

Login to post a reply

Server time is: 2024-11-25 03:40:33
Your offset time is: 2024-11-25 03:40:33