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

#1 2012-03-16 22:37:46

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Support with your project

Please post here if you need support on your project. I can give you a variety of scripts. Also feel free to ask if you want some music, and the genre. I'd be happy to help with any scripting. Here are some basic scripts:
Gliding to mouse:

when gf clicked
forever
 point towards [mouse-pointer v]
 move ((distance to [mouse-pointer v]) / [10]) steps
end
Bouncing off a circle:
when gf clicked
forever
 if <touching [sprite v]?>
  point towards [sprite v]
  turn clockwise (180) degrees
 end
move (speed) steps
end
Now that's just basic coding.
If your interested in hovering an object...

when gf clicked
set [speed v] to (100)
set [range v] to (100)
forever
 set y to (([sin v] of ((timer) * (speed))) *(range))
end
On that one, I tried to make it user-friendly. Speed is how fast it will move, range is how high it will go.  The actual range is range*2, but this range is in height.
You can perform a very fun action by changing the sine (sin) to a tangent (tan) It's the speed up, slow down in the middle, speed up affect.

Those are a few I thought up, there are plenty more I could name but I'd be up all night  tongue

________________________________________________________________________________
Added by request: Gravity
when gf clicked
forever
 if <key [right arrow v] pressed?>
  change [xvel v] by (1)
 end
 if <key [left arrow v] pressed?>
  change [xvel v] by (-1)
 end
 set [xvel v] to ((xvel) * (.87))
 change x by (xvel)
 if <touching [level v]?>
  change y by (([abs v] of (xvel)) + (1))
  if <touching [level v]?>
   change y by ((0) - (([abs v] of (xvel)) + (1)))
   change x by ((0)-(xvel))
   set [xvel v] to ((xvel) / (2))
  end
 end  
 if <key [up arrow v] pressed?>
  change y by (-1)
  if <touching [level v]?>
   set [yvel v] to (10)
  end
  change y by (1)
 end
 if <(yvel) < [3]>
  change y by (-1)
  if <not<touching [level v]?>>
   change [yvel v] by (-1)
  end
  change y by (1)
 end
 set [yvel v] to ((yvel) * (0.9))
 change y by (yvel)
 if <touching [level v]?>
  change y by ((0) - (yvel))
  set [yvel v] to ((yvel) / (2.5))
 end
end
I'll add a few more on by request.

Last edited by chanmanpartyman (2012-03-31 22:22:35)

Offline

 

#2 2012-03-16 22:49:58

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: Support with your project

I like the last script.

Offline

 

#3 2012-03-16 23:06:11

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

turkey3 wrote:

I like the last script.

tongue  Yeah, I use it a lot.

Offline

 

#4 2012-03-16 23:33:53

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Support with your project

Wow! Very nice scripts!  smile  However, could you maybe add a description to that last one to explain how it works! Thanks!


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#5 2012-03-16 23:44:49

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

Re: Support with your project

Add Gravity, seems like the "Help with Scripts" forum is getting filled up with ones that need help with gravity.


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

#6 2012-03-17 00:43:36

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

MaxFlyboy wrote:

Add Gravity, seems like the "Help with Scripts" forum is getting filled up with ones that need help with gravity.

Okay, do you want to know how to do it or do you want me to add it up at the top?

Offline

 

#7 2012-03-17 00:44:51

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

pi3 wrote:

Wow! Very nice scripts!  smile  However, could you maybe add a description to that last one to explain how it works! Thanks!

Well, it works by creating a sine wave. That's pretty much it  neutral

Offline

 

#8 2012-03-17 00:51:12

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

Re: Support with your project

chanmanpartyman wrote:

MaxFlyboy wrote:

Add Gravity, seems like the "Help with Scripts" forum is getting filled up with ones that need help with gravity.

Okay, do you want to know how to do it or do you want me to add it up at the top?

No, I know how to do it. It just gets kind of annoying answering 10 topics about how to do gravity. It helps to be able to put in a link that has the blocks.

Add it up at the top with the other scripts.


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

#9 2012-03-17 01:57:08

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

MaxFlyboy wrote:

chanmanpartyman wrote:

MaxFlyboy wrote:

Add Gravity, seems like the "Help with Scripts" forum is getting filled up with ones that need help with gravity.

Okay, do you want to know how to do it or do you want me to add it up at the top?

No, I know how to do it. It just gets kind of annoying answering 10 topics about how to do gravity. It helps to be able to put in a link that has the blocks.

Add it up at the top with the other scripts.

Oh, okay. I'll have it up tomorrow.

Offline

 

#10 2012-03-18 17:18:13

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Support with your project

Wall jumping script?


Get ready for domination of:  tongue

Offline

 

#11 2012-03-18 17:57:17

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Support with your project

chanmanpartyman wrote:

pi3 wrote:

Wow! Very nice scripts!  smile  However, could you maybe add a description to that last one to explain how it works! Thanks!

Well, it works by creating a sine wave. That's pretty much it  neutral

That doesn't really tell me much.  sad  What is a sine wave?


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#12 2012-03-18 22:34:01

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

pi3 wrote:

chanmanpartyman wrote:

pi3 wrote:

Wow! Very nice scripts!  smile  However, could you maybe add a description to that last one to explain how it works! Thanks!

Well, it works by creating a sine wave. That's pretty much it  neutral

That doesn't really tell me much.  sad  What is a sine wave?

It's a wave of slopes created by using the sine function.

Offline

 

#13 2012-03-18 22:40:40

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

coolhogs wrote:

Wall jumping script?

I'll have for you in 20-48 hrs.

Offline

 

#14 2012-03-18 22:44:24

Ecliptic
Scratcher
Registered: 2012-02-27
Posts: 500+

Re: Support with your project

Very nice and helpful scripts.  smile


If you can read this you are in range.

Offline

 

#15 2012-03-19 15:41:50

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: Support with your project

I also need some music.
Can you do some fairy music that slowly becomes suspense music? This should last 5 minutes.
Also can you do a "ding" sound? This should last 0.7 seconds.

Last edited by coolhogs (2012-03-19 16:01:30)


Get ready for domination of:  tongue

Offline

 

#16 2012-03-19 16:16:59

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

coolhogs wrote:

I also need some music.
Can you do some fairy music that slowly becomes suspense music? This should last 5 minutes.
Also can you do a "ding" sound? This should last 0.7 seconds.

I don't do sound effects, just music. Sorry  sad  Anyhow, I'll have it on a project on my test account (cmpm_test) and drop you a message when it's up.

Offline

 

#17 2012-03-19 16:22:03

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

coolhogs wrote:

Wall jumping script?

Implement this:

change x by (10)
if <touching [level v]?>
 if <key [up arrow v] pressed?>
  set [xv v] to (-10)
  set [yv v] to (10)
 end
end
change x by (-20)
if <touching [level v]?>
 if <key [up arrow v] pressed?>
  set [xv v] to (10)
  set [yv v] to (10)
 end
end
change x by (10)
If it doesn't work please contact me @ one of my projects so I get a message. Checking up on this is tedious.

Last edited by chanmanpartyman (2012-03-26 08:09:11)

Offline

 

#18 2012-03-23 16:52:03

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Support with your project

Mesh script:

when i receive [connect 1 v]  
set [connected v] to (1)  //first assume connection
if <(me) = (1)>
   broadcast [connect 2 v] and wait  
end
set [connected v] to (0) //only if the other script doesn't wait


when i receive [connect 2 v]  
set [connected v] to (1)  
if <(me) = (2)>
   broadcast [connect 1 v] and wait  
end
set [connected v] to (0) 

When one of the above two scripts is activated, it will check if the "me" variable is equal to one or two. Then it calls the other script, which will interrupt the first one waiting for the second one to finish (if it is in the other version of the project (the only way the "me variable to be different)), and wait for that script to finish, which if it still connected will interrupt the other script which will interrupt the first script.....
But if connection is lost, there will be no script to interrupt it, meaning the connected variable gets set to  0.


To set the "me" variable to the right value, use the following script:
when green flag clicked //or any hat
ask [Are you player 1? or player 2?] and wait
repeat until <<(answer) = (1)> or <(answer) = (2)>>
   ask (join (answer)[was not an option. Pick either 1 or 2.]) and wait
end
set [me v] to (answer)
repeat until <(connected) = (1)>
  broadcast (join [connect ](me)) 
  if <(me) = ([me v] sensor value)>
     say [Oops! Your opponent selected the same number! Press space to change player.] 
     wait until <<key [space v] pressed?> or <not<(me) = ([me v] sensor value)>>>
     if <key [space v] pressed?>
        set [me v] to ((3) - (me))
        say (join (join [You are now player ](me))(.)) for (1) secs
     else
         say (join (join [Other player changed. You are still player ](me))[.]) for (1) secs
     end
  end
end
forever if <(connected) = (0)>
   say [Connection error.] for (2) secs
   stop  all
end

when i receive [something v]//scripts where each player should do something different
if <(me) = (1)>
  stuff that player 1 does, not player 2
else
  stuff that player 2 does, not player 1
end

Last edited by joefarebrother (2012-03-23 16:53:12)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#19 2012-03-26 16:05:28

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

Agentpieface
these?

if <touching [level v]?>
 change y by (([abs v] of (xvel)) + (1))
 if <touching [level v]?>
  change y by ((0) - (([abs v] of (xvel)) + (1)))
  change x by ((0)-(xvel))
  set [xvel v] to (0)
 end
end  

Offline

 

#20 2012-03-26 16:16:12

Unite
Scratcher
Registered: 2012-03-24
Posts: 100+

Re: Support with your project

Mind getting me some adventurous music for the kirby game I'm making?


http://i1156.photobucket.com/albums/p570/bolemis/31023108819264274478797.gif

Offline

 

#21 2012-03-29 21:14:02

ftf841
Scratcher
Registered: 2012-02-19
Posts: 1000+

Re: Support with your project

Unite wrote:

Mind getting me some adventurous music for the kirby game I'm making?

here is some kirby superstar music http://downloads.khinsider.com/game-sou … super-star

Last edited by ftf841 (2012-03-29 21:14:41)


http://mag.racked.eu/cimage/i9002/Achievement++get%21/Hi+there./mca.png
http://mag.racked.eu/mcimage/i354/Achievement++get%21/CAKE%21%21%21%21%21/mca.png

Offline

 

#22 2012-05-21 13:19:00

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Support with your project

if <(y position) > [~150]>
 set y to [~150]
end
if <(y position) < [~-150]>
 set y to [~150]
end

Last edited by chanmanpartyman (2012-05-21 13:19:18)

Offline

 

#23 2012-05-21 13:34:33

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: Support with your project

I am doing a physics challenge for school, and I need to make a mobile that responds to the weight of different objects. Also, I need to have the objects respond to the tilting of the central bar. Here are the scripts so far:

when gf clicked //central bar scripts
forever
point in direction ((weight2) - (weight1))
Weight2 and weight1 are the different weights of the objects. Think you could help?


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#24 2012-05-21 13:51:45

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Support with your project

forever
switch to costume [ship v]
show
go to x: (xposship) y: (yposship)
if <key [up arrow v] pressed>
 change [yposship v] by [1]
end
if <key [down arrow v] pressed>
 change [yposship v] by [-1]
end
if <key [right arrow v] pressed>
 change [xposship v] by [1]
end
if <key [left arrow v] pressed>
 change [xposship v] by [-1]
end
switch to costume [enemy v]
go to x: (eposx) y: (eposy)
change [eposx v] by [1]
change [eposy v] by (slant)
if <touching color [#F7F5F6]> //whatever color
 change [ship lives v] by [-1]
 hide
end
 
Is this a good 1s1s script?

Last edited by mythbusteranimator (2012-05-21 13:54:55)


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#25 2012-05-22 05:03:43

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Support with your project

mythbusteranimator wrote:

forever
switch to costume [ship v]
show
go to x: (xposship) y: (yposship)
if <key [up arrow v] pressed ?>
 change [yposship v] by [1]
end
if <key [down arrow v] pressed ?>
 change [yposship v] by [-1]
end
if <key [right arrow v] pressed ?>
 change [xposship v] by [1]
end
if <key [left arrow v] pressed ?>
 change [xposship v] by [-1]
end
switch to costume [enemy v]
go to x: (eposx) y: (eposy)
change [eposx v] by [1]
change [eposy v] by (slant)
if <touching color [#F7F5F6] ?> //whatever color
 change [ship lives v] by [-1]
 hide
end
 
Is this a good 1s1s script?

Scripts fixed.  smile


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

Board footer