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

#1 2009-05-10 11:57:02

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Is it possible in scratch..

I am trying to recreate the first level of manic minor in scratch as an introduction to programming for my son.  I was wondering if anyone could provide any good pointers on how to create a platform game as most i have seen in scratch seem a bit poor, i.e. if the character jumps from one level to the other it can stop mid way through the platform etc. 

I have done some initial tests and keep finding that the sprite colission is a bit hit and miss, i.e. i have a sprite with coloured feet and my floors have a particular colour along the top edge so i check to see if the characters feet are touching this colour in part of my jump script however often find that once the character lands from a jump or jumps between levels it appears to go past the floor before stopping. 

Any advice appreciated.

Thanks

Offline

 

#2 2009-05-10 12:02:03

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Is it possible in scratch..

What I tend to use is put sensor sprites around the sprite, then make them invisible. Invisible things can still be sensed. So you'd have a sprite on the left, top, bottom, and right of the sprite, and you could make sure it would stop going left when the left sprite touched anything. This way, you can use sprite sensing instead of colour sensing.

If you want an example, see my project "The Little Pointless Project".

Offline

 

#3 2009-05-10 12:24:14

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Re: Is it possible in scratch..

Thanks for that you have restored my faith in being able to complete this project using scratch, however i see from the example you linked to that the blob still appears to go slightly through the floor at times, is there no way to stop this? my platforms are sprites that I stamp down and are all one colour apart from a few black dots in them and I need to ensure that when the character falls he lands on top of the level every time and not part way through it - does that make sense? i am trying to replicate this game -

http://www.bigredswitch.co.uk/games/mm/mm-pre-dis.html

Thanks

Offline

 

#4 2009-05-10 12:34:33

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Is it possible in scratch..

bryano wrote:

Thanks for that you have restored my faith in being able to complete this project using scratch, however i see from the example you linked to that the blob still appears to go slightly through the floor at times, is there no way to stop this? my platforms are sprites that I stamp down and are all one colour apart from a few black dots in them and I need to ensure that when the character falls he lands on top of the level every time and not part way through it - does that make sense? i am trying to replicate this game -

http://www.bigredswitch.co.uk/games/mm/mm-pre-dis.html

Thanks

I see your point, though I believe that what you are asking to do is impossible. Scratch isn't the greatest programming language in the world. You can still use colour sensing with my method, though.

Offline

 

#5 2009-05-10 12:39:46

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Re: Is it possible in scratch..

I have found that to use colour sensing efectively i had to make my sprite quite large and the two colours I wanted to test had to cover quite a large (visible) area rather than just a thin line of colour, so close yet so far!

Offline

 

#6 2009-05-10 14:17:51

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Is it possible in scratch..

Why not just have a loop that is triggered whenever you are on top of a platform to move the character up one step until it is no longer touching the color?  It might be embedded for a brief moment but would correct itself quickly.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#7 2009-05-11 07:27:43

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Is it possible in scratch..

what you could do is make your sencing sprites 2 toned, and then use a similer method to paddle2see's method. For example, if the bottom of the block is blue, and the top part is green, and the platforms are red, you could do this:

if colour [blue] is over colour [red]
gravity = 0

if colour [green] is over colour [red]
change y by 1

the reason why we dont just use one part of the sencor to do both is because when he gets himself out of the platform, he seems to 'bounce'

(I'm not sure if your using gravity, or just changing the y position making it fall at a constant speed. Also, if my code seems too look different to what scratch uses, apology, ive gotten use to flash)

Offline

 

#8 2009-05-11 14:42:24

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Re: Is it possible in scratch..

thanks for the great ideas so far its appreciated.  I have come up with a basic moving / jumping script which I have knocked together by looking at other peoples code, it works quite well in that unlike other examples i have come across the character can jump up through platforms and it continues up until it hits the max velocity and on its way down if it senses a platform it stops, here a link to it in case it helps other, one minor niggle is it still sometimes drops well in to the level before the code moves the sprite up to sit on top of the level(try it and you will understand what i am on about), if anyone has any ideas on how to improve on it please let me know.  Once I have a good sprite movement/jumping/collisions sorted I will make a start on using that code for my manic minor remake.

http://scratch.mit.edu/projects/bryano/522429

Thanks

Offline

 

#9 2009-05-12 14:03:41

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Re: Is it possible in scratch..

ok i'm beat im sure this just cant be done in scratch effectively, may be i'm expecting too much out of it but the collision detection is just unreliable when trying to create a platformer like manic minor - anyone care to prove me wrong?

Offline

 

#10 2009-05-12 14:40:48

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Is it possible in scratch..

i could probably get as close as possible in scratch, but without the ability of instant loops, its not gonna look as good as it should

Offline

 

#11 2009-05-12 14:47:37

bryano
Scratcher
Registered: 2009-04-26
Posts: 7

Re: Is it possible in scratch..

so i am trying to achieve the impossible?

Offline

 

#12 2009-05-13 13:10:30

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: Is it possible in scratch..

you could get it quite close, but its always gonna take a second or so to get out of the ground unfortunately

Offline

 

#13 2009-05-15 21:54:39

puppylover53
Scratcher
Registered: 2008-11-30
Posts: 4

Re: Is it possible in scratch..

I'm trying to make a road in witch the sprite can walk on that only... but I'm not sure it's that simple... any tips?

Offline

 

#14 2009-05-16 06:19:51

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Is it possible in scratch..

puppylover53 wrote:

I'm trying to make a road in witch the sprite can walk on that only... but I'm not sure it's that simple... any tips?

It's pretty easy to make something close....make the road a certain color and then put in a script that sets the speed of the character (use a variable for the speed) based on the color it is touching.  If the character is not touching the road color, set the speed WAY down.  Like this project:

http://scratch.mit.edu/projects/Paddle2SeeFixIt/492957


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#15 2009-05-16 07:17:48

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Is it possible in scratch..

I dont know if this would be useful but if you could download mine you could copy a few things out of it.
download

Offline

 

Board footer