Discuss Scratch

pixlecode
Scratcher
100+ posts

Solid Wall's

i was welcoming new scratchers, making everybody feel welcome and somebody asked me if i could help them with there script witch is “making solid walls” so i told them i would find out because i love that satisfaction you get when you help someone! Thank you ~pixlecode

Last edited by pixlecode (Aug. 17, 2014 19:27:25)


Money and fame is just an object and a rank but friends, and family is what matters most please don't say different because if you do you are not true to yourself Do a good deed everyday ~ here to help pixlecode
SurgeForce
Scratcher
100+ posts

Solid Wall's

What do you mean “solid walls”?
master_tolkien
Scratcher
100+ posts

Solid Wall's

For simple wall detection, like in pac-man, use something that turns the sprite in the opposite direction that it is facing, and then moves it 5 steps, or less depending on the size of the sprite (or maybe not, that's just what I assume, it's probably wrong ). Example:
if <touching [wall v] ?> then
turn ccw (180) degrees
move (5) steps

end
There are other more complicated ways to do the same thing that make it more perfect, but I'm not sure about those ways. I hope this helps

SCRRRRRRAAAAAAYYYYYTTTTCCHHHHH…

Swift, computer architecture, hippos.


Repeat: Programming Language in Scratch | Jump

Cyoce
Scratcher
500+ posts

Solid Wall's

when green flag clicked
forever

if <key [right arrow v] pressed?> then

change x by (5)
if <touching [wall v] ?>
change x by (-5)
end
end
if <key [left arrow v] pressed?> then

change x by (-5)
if <touching [wall v] ?>
change x by (5)
end

end
marioman20
Scratcher
43 posts

Solid Wall's

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
if <touching [wall (insert wall sprite name here) v] ?> then
move (0) steps
else
move (5) steps
end
end

repeat for all keys

a
pixlecode
Scratcher
100+ posts

Solid Wall's

marioman20 wrote:

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
if <touching [wall (insert wall sprite name here) v] ?> then
move (0) steps
else
move (5) steps
end
end

repeat for all keys
thank you..

Money and fame is just an object and a rank but friends, and family is what matters most please don't say different because if you do you are not true to yourself Do a good deed everyday ~ here to help pixlecode
Cyoce
Scratcher
500+ posts

Solid Wall's

pixlecode wrote:

marioman20 wrote:

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
if <touching [wall (insert wall sprite name here) v] ?> then
move (0) steps
else
move (5) steps
end
end

repeat for all keys
thank you..
That will not work. The problem is if you are right next to a wall, you will move 5. then you will be in the wall, and unable to move in any direction. Use the script I gave you. Repeat the process for up and down arrows. It will work. Trust me. Also, don't use the point in direction block with the move block like that. It gets weird. Use the change x by () and change y by () blocks.

Cyoce wrote:

when green flag clicked
forever

if <key [right arrow v] pressed?> then

change x by (5)
if <touching [wall v] ?>
change x by (-5)
end
end
if <key [left arrow v] pressed?> then

change x by (-5)
if <touching [wall v] ?>
change x by (5)
end

end

pixlecode
Scratcher
100+ posts

Solid Wall's

oh ok thanks so much!

Cyoce wrote:

pixlecode wrote:

marioman20 wrote:

when green flag clicked
forever
if <key [right arrow v] pressed?> then
point in direction (90 v)
if <touching [wall (insert wall sprite name here) v] ?> then
move (0) steps
else
move (5) steps
end
end

repeat for all keys
thank you..
That will not work. The problem is if you are right next to a wall, you will move 5. then you will be in the wall, and unable to move in any direction. Use the script I gave you. Repeat the process for up and down arrows. It will work. Trust me. Also, don't use the point in direction block with the move block like that. It gets weird. Use the change x by () and change y by () blocks.

Cyoce wrote:

when green flag clicked
forever

if <key [right arrow v] pressed?> then

change x by (5)
if <touching [wall v] ?>
change x by (-5)
end
end
if <key [left arrow v] pressed?> then

change x by (-5)
if <touching [wall v] ?>
change x by (5)
end

end


Money and fame is just an object and a rank but friends, and family is what matters most please don't say different because if you do you are not true to yourself Do a good deed everyday ~ here to help pixlecode
Cyoce
Scratcher
500+ posts

Solid Wall's

wkelly42
Scratcher
100+ posts

Solid Wall's

http://scratch.mit.edu/projects/19457007/

Try that script out

My Retro Arcade:
COMPLETED: Frogger, Missile Command, Computer Space.
IN DEVELOPMENT: Barnstorming, Time Pilot, Defender, River Raid, Karateka
NoChutney
Scratcher
48 posts

Solid Wall's

If you're happy to build your wall with sprites (preferably clones) then the collision detection in my platformer could be used. I prefer this to colour collisions as it removes restrictions on graphic design.

This is definitely work-in-progress. I haven't finished adding comments to the script, but the collision detection is there.

Feel free to take a look and see what you can make of it. http://scratch.mit.edu/projects/25711091/
Cyoce
Scratcher
500+ posts

Solid Wall's

NoChutney wrote:

If you're happy to build your wall with sprites (preferably clones) then the collision detection in my platformer could be used. I prefer this to colour collisions as it removes restrictions on graphic design.

This is definitely work-in-progress. I haven't finished adding comments to the script, but the collision detection is there.

Feel free to take a look and see what you can make of it. http://scratch.mit.edu/projects/25711091/
Check out my platformer engine.

Last edited by Cyoce (Aug. 22, 2014 00:42:20)

pixlecode
Scratcher
100+ posts

Solid Wall's

NoChutney wrote:

If you're happy to build your wall with sprites (preferably clones) then the collision detection in my platformer could be used. I prefer this to colour collisions as it removes restrictions on graphic design.

This is definitely work-in-progress. I haven't finished adding comments to the script, but the collision detection is there.

Feel free to take a look and see what you can make of it. http://scratch.mit.edu/projects/25711091/
cool!

Money and fame is just an object and a rank but friends, and family is what matters most please don't say different because if you do you are not true to yourself Do a good deed everyday ~ here to help pixlecode
NoChutney
Scratcher
48 posts

Solid Wall's

Cyoce wrote:

NoChutney wrote:

If you're happy to build your wall with sprites (preferably clones) then the collision detection in my platformer could be used. I prefer this to colour collisions as it removes restrictions on graphic design.

This is definitely work-in-progress. I haven't finished adding comments to the script, but the collision detection is there.

Feel free to take a look and see what you can make of it. http://scratch.mit.edu/projects/25711091/
Check out my platformer engine.
It's good, but there seems to be a bit issue - if you move the wall into a midair position, the player can hit the site of the wall and won't fall. That's the problem that I was trying to overcome, by making the block detect where the player is touching.
Cyoce
Scratcher
500+ posts

Solid Wall's

NoChutney wrote:

Cyoce wrote:

NoChutney wrote:

If you're happy to build your wall with sprites (preferably clones) then the collision detection in my platformer could be used. I prefer this to colour collisions as it removes restrictions on graphic design.

This is definitely work-in-progress. I haven't finished adding comments to the script, but the collision detection is there.

Feel free to take a look and see what you can make of it. http://scratch.mit.edu/projects/25711091/
Check out my platformer engine.
It's good, but there seems to be a bit issue - if you move the wall into a midair position, the player can hit the site of the wall and won't fall. That's the problem that I was trying to overcome, by making the block detect where the player is touching.
I'll work on that.

Powered by DjangoBB