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

#1 2012-07-21 13:19:08

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Is there a way...

1. Make a countdown for every bounce off of the edge or another sprite, starting at 16?

2. Make something move 5 steps along only a single axis but be the same place as the mouse on that axis (or try).

Last edited by Firedrake969 (2012-07-21 13:45:40)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#2 2012-07-21 13:20:15

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Is there a way...

You could change a variable by 1 whenever it bounces, ad then the variable is 16 stop the script.


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#3 2012-07-21 13:27:46

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

I mean with my pong game--how would it fit in that?


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#4 2012-07-21 13:30:54

gfchll
Scratcher
Registered: 2012-04-21
Posts: 100+

Re: Is there a way...

Wes64 wrote:

You could change a variable by 1 whenever it bounces, ad then the variable is 16 stop the script.

when gf clicked
set [number v] to (16)
if<<touching [edge v]>or<touching[sprite 1 v]>>
change [number v] by (-1)
end
like this?


HELLO EVERYBODY!

Offline

 

#5 2012-07-21 13:34:12

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

Yes, but I have a more complicated script, so it might not fit in.  Look at my game.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#6 2012-07-22 10:06:16

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

Anyone help me?  This is an example of a block (or blocks) I need:

move (5) steps to (mouse x)

Last edited by Firedrake969 (2012-07-22 10:45:53)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#7 2012-07-22 10:56:04

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Is there a way...

Could you use something like this?:

forever
if <(mouse x) < (x position)>
point in direction (-90)
else
point in direction (90)
end
if <(abs ((mouse x) - (x position))) > (5)>   
move (5) steps
end
end 
sorry my scripts are a little messed up:L

Last edited by Prestige (2012-07-22 10:59:33)


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#8 2012-07-22 11:05:21

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

YAY IT WORKED!!!


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#9 2012-07-23 13:45:25

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

Firedrake969 wrote:

1. Make a countdown for every bounce off of the edge or another sprite, starting at 16?

2. Make something move 5 steps along only a single axis but be the same place as the mouse on that axis (or try).


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#10 2012-07-23 14:01:54

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

An example of what I need is

for (var1) changed by (-1) change (var2) by (-1)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#11 2012-07-24 10:13:24

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

Anyone know of something that can help me?


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#12 2012-07-24 10:54:04

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Is there a way...

You could change them at the same time...How do the variables relate to each other?  Are they always equal?  Always a certain amount apart?


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#13 2012-07-24 12:14:45

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

Well, lets put it at this:  If you buy an asset, you get it for a certain number of bounces.  How do I make it count down until you have no bounces left, thus removing the asset?


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#14 2012-07-24 15:39:05

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Is there a way...

An alternative for movement along a single axis (that I think is more simple):

when gf clicked
forever if<([abs v] of ((mouse x)-(x position))) > [3]>
if<(mouse x) > (x position)>
change x by (5)
else
change x by (-5)
end
Making it "greater than 3" instead of "greater than 5" is a slight improvement on the last script, and using the "change x" block more explicitly shows what you want (if someone wants to download and look/understand your script) as well as - arguably - more directly accomplishing it.

Last edited by MoreGamesNow (2012-07-24 15:40:43)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#15 2012-07-24 16:56:14

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Is there a way...

I don't need it; I need the asset thing.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#16 2012-07-24 19:40:27

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Is there a way...

In your ball sprite, there is a script that looks like this:

if <touching [edge v]?>
if <(gball) = [true]>
point towards [Stick v]
move (6) steps
else
point in direction ((180)-(direction))
move (6) steps
turn cw (pick random (-40) to (40)) degrees
end
end
Add the "change [Bounces v] by (1)" block.

if <touching [edge v]?>
change [Bounces v] by (1)
if <(gball) = [true]>
point towards [Stick v]
move (6) steps
else
point in direction ((180)-(direction))
move (6) steps
turn cw (pick random (-40) to (40)) degrees
end
end

Last edited by MoreGamesNow (2012-07-24 19:40:49)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#17 2012-07-24 22:24:49

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Is there a way...

Closed by request of owner.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer