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

#1 2010-12-16 21:07:20

Cao14
New Scratcher
Registered: 2010-12-16
Posts: 1

how to make sprites separate in the when touching

how do i do this?
i am doing a car game and it would be a bit weird if cars could go through each other
when they touch they need to 'bump into each other' and go away from eachother

Thanks anyone who can answer this.

Cao14

Offline

 

#2 2010-12-17 10:34:21

StrykerV
New Scratcher
Registered: 2010-06-15
Posts: 51

Re: how to make sprites separate in the when touching

Cao14 wrote:

how do i do this?
i am doing a car game and it would be a bit weird if cars could go through each other
when they touch they need to 'bump into each other' and go away from eachother

Thanks anyone who can answer this.

Cao14

If the car game has a car you control, then try this:

<when green flag clicked>
<forever>
<if> << <key[ up arrow ]pressed?> <and> <( <{ Move up }> <=> 1 )> >>
<change y by( 10
<end>
<if> << <key[ down arrow ]pressed?> <and> <( <{ Move down }> <=> 1 )> >>
<change y by( -10
<end>
<if> << <key[ right arrow ]pressed?> <and> <( <{ Move right }> <=> 1 )> >>
<change x by( 10
<end>
<if> << <key[ left arrow ]pressed?> <and> <( <{ Move left }> <=> 1 )> >>
<change x by( -10
<end>
<end>

And then you could say forever if touching another car set move (whichever side its on) to 0.


99.9999% Crazy, 0.0001% Hamburgeh Makeh  smile

Offline

 

Board footer