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

#1 2013-05-02 11:12:04

WabbaHarry
New Scratcher
Registered: 2012-11-06
Posts: 21

Detector for a variable increasing?

Hello i was wondering if there was a way to trigger something when a variable increases by a certain amount. e.g. If X increases by 8 Increase Y by 1. If there is any simple way to do this please let me know.

Thanks
WabbaHarry

Offline

 

#2 2013-05-02 11:56:23

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: Detector for a variable increasing?

WabbaHarry wrote:

Hello i was wondering if there was a way to trigger something when a variable increases by a certain amount. e.g. If X increases by 8 Increase Y by 1. If there is any simple way to do this please let me know.

Thanks
WabbaHarry

Yes, there is.
Here is an example:

if <(life)> [0]= // if life is zero
broadcast [game over v]//send a message to all the sprites saying game over
I hope this helps!  smile

Last edited by joshuaho (2013-05-02 11:58:13)


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#3 2013-05-02 14:36:20

WabbaHarry
New Scratcher
Registered: 2012-11-06
Posts: 21

Re: Detector for a variable increasing?

Sorry it didnt really help I wanted something like

If (X) is increased by [8]
increase Y by 1

Offline

 

#4 2013-05-02 15:20:25

WabbaHarry
New Scratcher
Registered: 2012-11-06
Posts: 21

Re: Detector for a variable increasing?

The only reason I want this is so that i can have a scrolling game where you can place(using clones) however i need the Current X to change by 1 when Scroll X changes by 8

Offline

 

#5 2013-05-02 16:13:35

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: Detector for a variable increasing?

WabbaHarry wrote:

Sorry it didnt really help I wanted something like

If (X) is increased by [8]
increase Y by 1

You mean this?

if  <(x)> = [1]
change [x] by (1)

Last edited by joshuaho (2013-05-02 16:14:56)


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#6 2013-05-02 16:37:01

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Detector for a variable increasing?

joshuaho wrote:

WabbaHarry wrote:

Sorry it didnt really help I wanted something like

If (X) is increased by [8]
increase Y by 1

You mean this?

if  <(x) = [1]>
change [x v] by (1)
end

No. He means that if a script just altered Scroll X to be 8 bigger, then Current X should change by 1. That, or every interval of 8 in (Scroll X), (Current X) should be increased.

To WabbaHarry:
Well, I just thought that I might not be understanding you as much as possible. So, do you want (Current X) to change by 1 if (Scroll X) got changed by 4, and then by 5?

With regards,

ErnieParke

Last edited by ErnieParke (2013-05-02 16:37:26)


http://i46.tinypic.com/35ismmc.png

Offline

 

#7 2013-05-02 17:32:46

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: Detector for a variable increasing?

ErnieParke wrote:

joshuaho wrote:

WabbaHarry wrote:

Sorry it didnt really help I wanted something like

If (X) is increased by [8]
increase Y by 1

You mean this?

if  <(x) = [1]>
change [x v] by (1)
end

No. He means that if a script just altered Scroll X to be 8 bigger, then Current X should change by 1. That, or every interval of 8 in (Scroll X), (Current X) should be increased.


With regards,

ErnieParke

Oh well, I can't help him if I don't know much about what he wants. Sorry.


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#8 2013-05-03 11:18:49

WabbaHarry
New Scratcher
Registered: 2012-11-06
Posts: 21

Re: Detector for a variable increasing?

ErnieParke wrote:

That, or every interval of 8 in (Scroll X), (Current X) should be increased.

That is What I would like to do if it is possible to do so if you could help.

Thanks

Offline

 

#9 2013-05-03 16:15:33

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Detector for a variable increasing?

WabbaHarry wrote:

ErnieParke wrote:

That, or every interval of 8 in (Scroll X), (Current X) should be increased.

That is What I would like to do if it is possible to do so if you could help.

Thanks

Well then just use this little script:

set [Current X v] to (round ((Scroll X) / (8)))

I hope that this helped!

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

#10 2013-05-03 16:46:47

WabbaHarry
New Scratcher
Registered: 2012-11-06
Posts: 21

Re: Detector for a variable increasing?

Wow *FACEPALM* how did i not think of that. Herp de derp. Yeah the only reason i wanted this is so i could make a scrolling building game. Thanks Guys Ill Try this and ask again if it no work.

Offline

 

#11 2013-05-03 16:53:15

WabbaHarry
New Scratcher
Registered: 2012-11-06
Posts: 21

Re: Detector for a variable increasing?

Ok This didn't do what i was looking for but thanks for the help as i now know how to make this. I'll Post a new thread on what i need to do completely.

Offline

 

Board footer