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

#1 2012-10-15 21:34:54

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Free Scripts!

Here are some scripts to use in your projects! Reply with more if you can!

To make a good platformer, I suggest doing this for jumping (I think) (I'll add moving around later):

when gf clicked
forever
if <touching color [#000000]?>
  repeat until <key [up arrow v] pressed?>
    set [yvel v] to (0)
  end
else
repeat until <touching color [#000000]?>
change [yvel v] by (-0.3)
end
end
end
when gf clicked
forever
if <key [up arrow v] pressed?>
  if <touching color [#000000]?>
    repeat (14)
      change [yvel v] by (0.5)
else
  change [yvel v] by (-0.6)
end
change y by (yvel)
end
Here is a script that selects something random to do:
 set [random v] to (pick random (1) to (however many different possible actions there are))
if <(random) = [1]>
  first script
end
if <(random) = [2]>
  second script
end
etc.

Last edited by awesomeness321 (2012-10-19 15:57:38)


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#2 2012-10-16 00:11:27

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: Free Scripts!

Well, if you add that to a platformer, you should have a

change y by (yvel)
so that it actually does something.

For the something random to do, if it's between 2 scripts:
if <(pick random (1) to (2)) = [1]>
do script
else
do other script
end
if it's between a number of scripts (that's more than 2):
set [random# v] to <pick random (1) to (3)> //the 3 can be replaced with any number
if <(random#)=[1]>
script
end
if <(random#)=[2]>
other script
end
if <(random#)=[3]>
another script
end  //repeat this process for however many scripts you have.

Offline

 

#3 2012-10-17 16:32:04

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: Free Scripts!

TorbyFork234 wrote:

Well, if you add that to a platformer, you should have a

change y by (yvel)
so that it actually does something.

For the something random to do, if it's between 2 scripts:
if <(pick random (1) to (2)) = [1]>
do script
else
do other script
end
if it's between a number of scripts (that's more than 2):
set [random# v] to <pick random (1) to (3)> //the 3 can be replaced with any number
if <(random#)=[1]>
script
end
if <(random#)=[2]>
other script
end
if <(random#)=[3]>
another script
end  //repeat this process for however many scripts you have.

For the first one, I know, but I forgot.
EDIT: There, it's there now.

For the second one, that was what I was going to put!

Last edited by awesomeness321 (2012-10-17 16:33:10)


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#4 2012-10-18 16:34:43

ahorseowner
Scratcher
Registered: 2012-10-18
Posts: 23

Re: Free Scripts!

I have a game called jump, I need to make the rabbit not just float in the air until you let go of the up button, I'd like to do gravity... you can download the game and post it in the comments, please!


"Adventure is worthwile in itself." -Amelia Earhart

Offline

 

#5 2012-10-18 21:42:18

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Free Scripts!

awesomeness321 wrote:

Here are some scripts to use in your projects! Reply with more if you can!

To make a good platformer, I suggest doing this for jumping (I think) (I'll add moving around later):

when gf clicked
forever
if <touching color [#000000]?>
set [yvel v] to (0)
else
repeat until <touching color [#000000]?>
change [yvel v] by (-0.5)
end
end
if <key [up arrow v] pressed?>
  if <touching color [#000000]?>
    repeat (15)
      change [yvel v] by (0.5)
    end
    set [yvel v] to [0]
    repeat (15)
    change [yvel v] by (-0.5)
    end
    set [yvel v] to [0]
  end
  set [yvel v] to [0]
else
  change [yvel v] by (-0.6)
end
change y by (yvel)
end
Here is a script that selects something random to do:
 set [random v] to (pick random (1) to (however many different possible actions there are))
if <(random) = [1]>
  first script
end
if <(random) = [2]>
  second script
end
etc.

HOw many times do we have to say this. The jump part makes the cat accelerate upwards, suddenly stop, and start fall downwards, and suddenly stop.

Last edited by Molybdenum (2012-10-18 21:42:42)


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#6 2012-10-19 15:57:59

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: Free Scripts!

Molybdenum wrote:

awesomeness321 wrote:

Here are some scripts to use in your projects! Reply with more if you can!

To make a good platformer, I suggest doing this for jumping (I think) (I'll add moving around later):

when gf clicked
forever
if <touching color [#000000]?>
set [yvel v] to (0)
else
repeat until <touching color [#000000]?>
change [yvel v] by (-0.5)
end
end
if <key [up arrow v] pressed?>
  if <touching color [#000000]?>
    repeat (15)
      change [yvel v] by (0.5)
    end
    set [yvel v] to [0]
    repeat (15)
    change [yvel v] by (-0.5)
    end
    set [yvel v] to [0]
  end
  set [yvel v] to [0]
else
  change [yvel v] by (-0.6)
end
change y by (yvel)
end
Here is a script that selects something random to do:
 set [random v] to (pick random (1) to (however many different possible actions there are))
if <(random) = [1]>
  first script
end
if <(random) = [2]>
  second script
end
etc.

HOw many times do we have to say this. The jump part makes the cat accelerate upwards, suddenly stop, and start fall downwards, and suddenly stop.

I changed the script. It should work now.

Last edited by awesomeness321 (2012-10-19 16:05:05)


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#7 2012-10-19 16:08:33

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Free Scripts!

awesomeness321 wrote:

Molybdenum wrote:

awesomeness321 wrote:

Here are some scripts to use in your projects! Reply with more if you can!

To make a good platformer, I suggest doing this for jumping (I think) (I'll add moving around later):

when gf clicked
forever
if <touching color [#000000]?>
set [yvel v] to (0)
else
repeat until <touching color [#000000]?>
change [yvel v] by (-0.5)
end
end
if <key [up arrow v] pressed?>
  if <touching color [#000000]?>
    repeat (15)
      change [yvel v] by (0.5)
    end
    set [yvel v] to [0]
    repeat (15)
    change [yvel v] by (-0.5)
    end
    set [yvel v] to [0]
  end
  set [yvel v] to [0]
else
  change [yvel v] by (-0.6)
end
change y by (yvel)
end
Here is a script that selects something random to do:
 set [random v] to (pick random (1) to (however many different possible actions there are))
if <(random) = [1]>
  first script
end
if <(random) = [2]>
  second script
end
etc.

HOw many times do we have to say this. The jump part makes the cat accelerate upwards, suddenly stop, and start fall downwards, and suddenly stop.

I changed the script. It should work now.

Still doesn't work.

when gf clicked
forever
   if <touching color [#000000]?>
      set [yv v] to [0]
      if <key [up arrow v] pressed?>
         set [yv v] to [5]
      end
   else
      change [yv v] by (-.5)
   end
end

Last edited by Molybdenum (2012-10-19 16:09:29)


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

Board footer