Eggybunz
Eggybunz

Reputation: 21

My collision detection program for projectiles would not work in Scratch. (forever) If touching {wall} (whatever output)

I've tried multiple outputs for the program and nothing. I've singled out that some random program inside the sprite somewhere must be canceling out my program for that sprite. Here is the link to the project, just click "look inside" to see my program. https://scratch.mit.edu/projects/500277397

Here's my scratch code.

Upvotes: 1

Views: 994

Answers (1)

CoderTang
CoderTang

Reputation: 500

You just need to reverse steps once it touches the wall. No other fancy stuff needed

when green flag clicked
forever
    if key space pressed
        move (put number of steps) steps
        if touching wall
            move -(put number of steps) steps

Upvotes: 1

Related Questions