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

#1 2009-02-10 11:15:22

AOITCrenshaw
Scratcher
Registered: 2009-02-02
Posts: 1

Making a moving instance of an object in scratch

How would I make an instance of a bullet appear from a tank and move in the direction that the tank is facing? any help is appriciated

Offline

 

#2 2009-02-10 11:31:55

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Making a moving instance of an object in scratch

point in direction (Tank's direction)
move X steps
blocks Used:
<point in direction( direction of [Tank] )  direction of is found under sencing
<move(   )steps>

Offline

 

#3 2009-02-10 11:41:12

mrweston
Scratcher
Registered: 2007-12-13
Posts: 100+

Re: Making a moving instance of an object in scratch

More fully:

When I receive [shoot] {
    Go to [tank]
    Change x by (amount)
    Change y by (amount)
    Point in direction (direction of tank)
    Show
    Repeat until <touching edge> {
        Move (10) steps
    }
    Hide
}

The change x/y part is to make sure the bullet appears to come out of the tank's barrel; tweak as necessary. The Repeat could be a set number, instead of until touching the edge; that would control the shot's distance. The 10 in the Move (10) steps will be the speed of the bullet.

Offline

 

Board footer