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

#1 2012-05-09 19:22:28

maglet123
Scratcher
Registered: 2012-05-09
Posts: 5

help with scripts

how do you make things moveable it will be way easier to know so i can make better games

Last edited by maglet123 (2012-08-10 14:59:36)

Offline

 

#2 2012-05-09 19:54:06

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

Re: help with scripts

Could you maybe tell a little more about what you need help with? Do need the sprites to move on their own in a specific direction? Click and drag? Player movement?   smile

Last edited by pi3 (2012-05-09 19:54:50)


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

Offline

 

#3 2012-05-10 02:46:26

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: help with scripts

If you want click and drag, simply click on the lock button next to the name of the sprite at the top of the page. That will make it draggable for people viewing the project. If you need the player to move it, have a, when___key pressed, and then tell it what to do. Or you could get more complex and have a, when GF pressed, forever, if key___pressed, and again tell it what to do. if you need it to move on it's own, that's more complex, and  I don't want to explain it until I know what you're planning on.


Why are the secret organizations getting all the attention?  mad

Offline

 

#4 2012-05-10 20:57:59

PencilFactory
Scratcher
Registered: 2011-11-11
Posts: 100+

Re: help with scripts

Draggable: click on the lock to the right of the name of the sprite.
Arrow key moving:

when key [up arrow/w v] pressed
point in direction (0 v)
move <speed> steps
when key [down arrow/s v] pressed
point in direction (180 v)
move <speed> steps
when key [left arrow/a v] pressed
point in direction (-90 v)
move <speed> steps
when key [right arrow/d v] pressed
point in direction (90 v)
move <speed> steps

Last edited by PencilFactory (2012-05-10 20:59:21)


PencilFactory is http://blocks.scratchr.org/API.php?user=PencilFactory&amp;action=onlineStatus&amp;type=text, see my computerhttp://mag.racked.eu/cimage/i9002/Achievement+get%21/Computer+crashed/mca.png

Offline

 

#5 2012-05-11 01:47:55

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: help with scripts

The scripts will depend on the type of movement you require.


http://trinary.tk/images/signature_.php

Offline

 

#6 2012-05-11 06:27:23

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

Re: help with scripts

How about this?

when gf clicked
set [draggable? v] to [false]
forever if <(mouse down?) and (touching [mouse-pointer v] ? )>
if <(draggable?) = [false]>
set [draggable? v] to [true]
repeat until <not (mouse down?)>
go to [mouse-pointer v]
end
set [draggable? v] to [false]
end

Last edited by jontmy00 (2012-05-11 06:28:02)


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

Offline

 

#7 2012-05-11 07:15:51

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

Re: help with scripts

@jontmy00: that will make the sprite draggable if you hold down the mouse and run it over the sprite.  It will also create a small "snapping" effect when it first goest into effect.

A more accurate script is this:

when [sprite 1] clicked
set [x v] to ((mouse x)-(x position))
set [y v] to ((mouse y)-(y position))
repeat until <<(dragable?) = (true)> or <not <mouse down?>>>
go to x: ((mouse x)-(x)) y: ((mouse y)-(y))
end

Last edited by MoreGamesNow (2012-05-11 07:16:02)


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

Offline

 

#8 2012-05-11 08:45:52

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

Re: help with scripts

MoreGamesNow wrote:

@jontmy00: that will make the sprite draggable if you hold down the mouse and run it over the sprite.  It will also create a small "snapping" effect when it first goest into effect.

A more accurate script is this:

when [sprite 1] clicked
set [x v] to ((mouse x)-(x position))
set [y v] to ((mouse y)-(y position))
repeat until <<(dragable?) = (true)> or <not <mouse down?>>>
go to x: ((mouse x)-(x)) y: ((mouse y)-(y))
end

I admit. Your's better. I'll use it in my Pong game if needed.  smile


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

Offline

 

#9 2012-05-15 15:12:24

maglet123
Scratcher
Registered: 2012-05-09
Posts: 5

Re: help with scripts

thx every one i know how to do it now check out my new sonic sence creator

Offline

 

#10 2012-05-18 05:01:37

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

Re: help with scripts

maglet123 wrote:

thx every one i know how to do it now check out my new sonic sence creator

Now hit the "report" button below                  vv     and request for it to be closed.


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

Offline

 

Board footer