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

#1 2011-11-24 10:10:38

Garr8
Scratcher
Registered: 2011-08-10
Posts: 1000+

help with script

i need help with script, i can get the gun to shoot but i cant get the soldier to die, what scripts do i need to use to have him fall dead and then respawn?


What I scored on Pokemon Quiz: Porygon

Offline

 

#2 2011-11-24 10:21:14

silvershine
Scratcher
Registered: 2010-11-21
Posts: 500+

Re: help with script

I'm not exactly sure what the set up of your game is like, so this is just a basic script:

http://img190.imageshack.us/img190/8587/helpxp.png

When the sprite touches the bullet sprite, it will hide, and change the players score by 1. Next, I set it to go to a random place on the screen.


Hope that helps!

Offline

 

#3 2011-11-24 14:34:34

Garr8
Scratcher
Registered: 2011-08-10
Posts: 1000+

Re: help with script

thxs but there is no bullet, just the rifle with firing animation.


What I scored on Pokemon Quiz: Porygon

Offline

 

#4 2011-11-24 15:02:40

Lar-Rew
Scratcher
Registered: 2010-02-19
Posts: 100+

Re: help with script

This (I'm virtually certain, I extensively tested it) works:

http://lasergnlsdjkfila.weebly.com/uploads/4/6/4/3/4643709/6544752_orig.gif

If the rifle is "hitting" even if it isn't pointed at the character, make the 10 smaller.  If the rifle isn't "hitting" even if it is pointed at the character, make then 10 larger.

Looks like the image got compressed.  Right click+view to see the full size.

That is kind of advanced, so don't worry if you don't understand it.  Basically, I'm using the arctan function to figure out the direction of the player relative to the rifle, and then comparing it to the direction of the rifle.

Last edited by Lar-Rew (2011-11-24 15:06:16)

Offline

 

#5 2011-11-25 10:56:10

Garr8
Scratcher
Registered: 2011-08-10
Posts: 1000+

Re: help with script

i tried it but instead of the guy dying he goes flying all over the place


What I scored on Pokemon Quiz: Porygon

Offline

 

#6 2011-11-25 11:37:56

silvershine
Scratcher
Registered: 2010-11-21
Posts: 500+

Re: help with script

Garr8 wrote:

i tried it but instead of the guy dying he goes flying all over the place

In Lar-Rew's script, when he dies, he goes  to a random place on the screen. You could possible tweak the code so that when he dies, he hides for a second, and then goes to a random place on the screen.

Offline

 

#7 2011-11-25 12:00:20

Garr8
Scratcher
Registered: 2011-08-10
Posts: 1000+

Re: help with script

ill try that


What I scored on Pokemon Quiz: Porygon

Offline

 

Board footer