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

#1 2012-04-16 20:57:25

Dignified
Scratcher
Registered: 2012-02-24
Posts: 43

I need help with my platformer please!

http://scratch.mit.edu/projects/Dignified/2474360
I know there are a few bugs and I don't know how to fix them. There are two charactors to help you find the bugs. Can people please help me find solutions. If so it would be great!

big_smile

Offline

 

#2 2012-04-18 14:12:33

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: I need help with my platformer please!

to stop sprites going through walls:

forever
if <key [left v] pressed>
change x by (variable)//this can be any number or variable if you've used that instead
if <touching [walls v]>//or colour blue, just that I'm not totally sure how to do colours on ScratchBlocks!
change x by ((variable)*-[1])
end
end
if <key [right v] pressed>
change x by (variable)
if <touching [walls v]>
change x by ((variable)*[-1])
There is another way involving changeing direction but this is what I use.


http://i46.tinypic.com/ao03lk.png

Offline

 

#3 2012-04-18 14:17:23

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: I need help with my platformer please!

can anyone tell me how to write "key left pressed" in scratchblocks so it works!!!

and also, sorry! the second blue block was meant to be like the last green block. I'm new!


http://i46.tinypic.com/ao03lk.png

Offline

 

#4 2012-04-18 15:51:17

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

Re: I need help with my platformer please!

it needs a question mark at the end

Also, that script just makes you go left all the time.

Also, it's good to give variables meaningful names, this one looks like it should be called 'speed'

Also to do colours, just type it in hexadecimal inside square brackets (look it up on wikipedia)

forever
if <key [left v] pressed?>
change x by (speed)
if <touching color [#0000ff]?>
change x by ((speed)*[-1])
end
end
if <key [right v] pressed?>
change x by ((speed)*[-1])
if <touching color[#0000ff]?>
change x by (speed)
Script fixed!

Last edited by joefarebrother (2012-04-18 15:57:03)


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

 

Board footer