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

#1 2012-03-17 14:51:43

bmpatschool
New Scratcher
Registered: 2012-02-22
Posts: 9

Air Hockey issues

I am attempting to make a game similar to air hockey with both a two-player and a single-player version with a cpu. My two-player version works perfectly. However, even though the puck has the exact same code on the CPU version, it goes straight to a corner and "sticks" there. The puck is supposed to bounce off of a certain sprite (sprite 4) that makes up a border. Even though the code is the exact same thing for bouncing off of the border on the CPU version, it "sticks".

The border is "sprite 4"
The human player is "paddle right"
The computer player is "CPU"


This is the code on both the CPU and two-player versions for bouncing off of the paddles and the border. I know that I could just use "if on edge, bounce", but I would prefer to use this complex border.
The game is at http://scratch.mit.edu/projects/bmpatschool/2402236 For some reason, it does not work at all online, but does work when you download it (except for the previously discussed issues).

when gf clicked
forever
   if <touching (Sprite 4)>
      turn 180 degrees
      end
   if <touching (CPU)>
      point in direction 90
      turn pick random -45 to 45 degrees
      end
   if <touching (Paddle Right)>
      point in direction -90
      turn pick random -45 to 45 degrees

Offline

 

#2 2012-03-17 16:54:27

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Air Hockey issues

Looks like you've already got a topic about this issue over here.  Instead of making a new topic, please just add new posts to your existing one.  Thanks!


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer