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

#1 2007-05-31 17:04:19

Strike5
Scratcher
Registered: 2007-05-31
Posts: 1

Won't regester when touching left edge.

I'm trying to make a pong program but the ball won't regester that it has touched the left edge which I have colored blue.  My code for it currently is

[when flag clicked]
set player 1 to (0)
set player 2 to (0)
forever
move (3) steps
if on edge, bounce
if <touching sprite1>
play sound Laser2
turn 180 degrees
point in direction (pick random (70) to (180))
if <touching sprite2>
play sound Laser2
turn 180 degrees
point in direction (pick random (-70) to (-180))

[when flag clicked]
go to x:-170 y:-20
forever
if <touching color red>
change player 1 by (1)
go to x:-170 y:-20

[when flag clicked]
forever
if <touching color blue>
change player 2 by (1)
go to x:170 y: -20

Is my problem the fact that the right edge isn't touching blue?

Offline

 

#2 2007-05-31 17:28:18

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Won't regester when touching left edge.

The first thing that springs to mind is to check that your edge is in fact the exact same blue as you "touching" script.

And also that the ball isn't bouncing due to the "bounce" command before it touches the blue area.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer