This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-11-24 15:47:17

TheSalamander
Scratcher
Registered: 2009-11-23
Posts: 16

Bullet Collision

I am currently reworking the system I am using for the bullets on my game and they currently pool as opposed to having 3 per enemy.

The issue is becasue I am going to have 30 bullet sprites and 10 enemy sprites how would I make the collisions for them. Running if statements in forever or forever if loops doesnt seem efficient if there are over 300 possible collion combinations.

So if anyone has any ideas on how to code for the collisions without having a multitude of code running all the time then please share  smile

Any help appreciated  smile

[needs to be downloaded to view properly: http://scratch.mit.edu/projects/TheSalamander/772012]

Last edited by TheSalamander (2009-11-24 15:47:53)

Offline

 

#2 2009-11-24 16:02:08

Ssbrawl700
Scratcher
Registered: 2009-02-11
Posts: 100+

Re: Bullet Collision

You can color the tip of each bullet and enemy a certain color and say

when flag click
  forever
    if touching color [red]
      do whatever u want it to do

Last edited by Ssbrawl700 (2009-11-24 16:02:16)


Can you beat the ever-so challenging Keyboard Khaos?

Offline

 

#3 2009-11-24 16:09:50

TheSalamander
Scratcher
Registered: 2009-11-23
Posts: 16

Re: Bullet Collision

-facepalm-
I'm an idiot...

Thank you!

Offline

 

#4 2009-11-26 02:37:24

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: Bullet Collision

i would add this if u r taking off health from the enemy, or doing something that cud happen over and over again (like adding money etc.)

when flag clikd
  forever
    if touchin colour [red]
      change health or wateva
      wait untill NOT touchin colour [red]


this wud mean the bullet wud hav to dissapear (acivated by anothe script on the bullet) before more health cud be taken off due to that bullet.


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

Board footer