Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Ik it seems silly, but wall collision
- BIGGERSHOT127
- Scratcher
81 posts
Ik it seems silly, but wall collision
pentagon palace. you know what it is. pizza tower ripoff. NOW, currently its just a player engine, which i need some help with making rooms :p and also a big thing: WALL COLLISION. ive tried multiple things but i cant seem to find a solution. i know how to make a basic camera engine for the roo-
play sound [EXTERMELY LOUD INCORRECT BUZZER v]I just cant make wall collision somehow
—————————————————————————
Pentagon palace Is one of my biggest projects yet! If you would like to help with it, Go here!
when green flag clicked
stop [the green flag from being clicked v]
when I receive [green flag not clicked v]
panic
define panic
DELETE SYS_32
DESTROY BOOT SECTOR
RUN FOR YOUR LIFE
- kooqle
- Scratcher
95 posts
Ik it seems silly, but wall collision
This script might help:
when green flag clicked
forever
if <touching [edge v] ?> then
collision code
end
end
Scratch on, superb scratchers!
- michaltygr
- Scratcher
7 posts
Ik it seems silly, but wall collision
pentagon palace. you know what it is. pizza tower ripoff. NOW, currently its just a player engine, which i need some help with making rooms :p and also a big thing: WALL COLLISION. ive tried multiple things but i cant seem to find a solution. i know how to make a basic camera engine for the roo-play sound [EXTERMELY LOUD INCORRECT BUZZER v]I just cant make wall collision somehow
when green flag clicked
forever
check for collision
end
define check for collision
if <touching [Level v] ?> then
set [_collisionvariable v] to [0]
reset timer
repeat until <not <touching [Level v] ?>>
change x by ([sin v] of ((_collisionvariable)) * (timer))
change [_collisionvariable v] by (0.5)
end
end
idk if this works i just came up with this
Last edited by michaltygr (May 15, 2024 18:03:37)
- BIGGERSHOT127
- Scratcher
81 posts
Ik it seems silly, but wall collision
Idk lemme checkpentagon palace. you know what it is. pizza tower ripoff. NOW, currently its just a player engine, which i need some help with making rooms :p and also a big thing: WALL COLLISION. ive tried multiple things but i cant seem to find a solution. i know how to make a basic camera engine for the roo-play sound [EXTERMELY LOUD INCORRECT BUZZER v]I just cant make wall collision somehowwhen green flag clicked
forever
check for collision
end
define check for collision
if <touching [Level v] ?> then
set [_collisionvariable v] to [0]
repeat until <not <touching [Level v] ?>>
change x by ([sin v] of (((_collisionvariable)) * (timer)))
change [_collisionvariable v] by (0.5)
end
end
idk if this works i just came up with this
—————————————————————————
Pentagon palace Is one of my biggest projects yet! If you would like to help with it, Go here!
when green flag clicked
stop [the green flag from being clicked v]
when I receive [green flag not clicked v]
panic
define panic
DELETE SYS_32
DESTROY BOOT SECTOR
RUN FOR YOUR LIFE
- Nolswit
- Scratcher
71 posts
Ik it seems silly, but wall collision
make a hitbox costume inside of your player sprite that is about the size of your player and make sure the hitbox costume is a rectangle/square (you just need a quadrilateral with straight sides so that it does not get hooked on anything) then for collisions I do this…
when green flag clicked
forever
switch costume to [hitbox v]
set rotation style [left-right v]
yada yada here for when movement keys are pressed
move cuhh (90) (player x speed) :: #000000
// the direction part can be either 90 or -90 depending on what direction you are moving
end
define move cuhh (direction) (Speed)basically, it just reverts your action if you come into contact with the wall. also don't forget to set the custom block to “run without screen refresh” or it will look like the player is spazzing out
change x by (Speed)
point in direction (direction)
set [how touchy am I? v] to [0]
repeat until <<(how touchy am I?) = [8]> or <not <touching [wall v] ?>>>
change [how touchy am I? v] by [1]
end
if <(how touchy am I?) = [8]> then
change x by ((Speed) * (-1))
end
ask [Are you subscribed to Nolswit on Youtube?] and wait
if <(answer) = [Yes]> then
say [Thank You!]
else
Redirect To [www.youtube.com/@Nolswit]
end
- BIGGERSHOT127
- Scratcher
81 posts
Ik it seems silly, but wall collision
this has one problem: i already have a custom block for movement : p make a hitbox costume inside of your player sprite that is about the size of your player and make sure the hitbox costume is a rectangle/square (you just need a quadrilateral with straight sides so that it does not get hooked on anything) then for collisions I do this…when green flag clicked
forever
switch costume to [hitbox v]
set rotation style [left-right v]
yada yada here for when movement keys are pressed
move cuhh (90) (player x speed) :: #000000
// the direction part can be either 90 or -90 depending on what direction you are moving
enddefine move cuhh (direction) (Speed)basically, it just reverts your action if you come into contact with the wall. also don't forget to set the custom block to “run without screen refresh” or it will look like the player is spazzing out
change x by (Speed)
point in direction (direction)
set [how touchy am I? v] to [0]
repeat until <<(how touchy am I?) = [8]> or <not <touching [wall v] ?>>>
change [how touchy am I? v] by [1]
end
if <(how touchy am I?) = [8]> then
change x by ((Speed) * (-1))
end
i tried it: it worked (with some minor improvements) but when the character goes ontop of the wall it just falls right through
Last edited by BIGGERSHOT127 (May 16, 2024 01:08:20)
—————————————————————————
Pentagon palace Is one of my biggest projects yet! If you would like to help with it, Go here!
when green flag clicked
stop [the green flag from being clicked v]
when I receive [green flag not clicked v]
panic
define panic
DELETE SYS_32
DESTROY BOOT SECTOR
RUN FOR YOUR LIFE
- BIGGERSHOT127
- Scratcher
81 posts
Ik it seems silly, but wall collision
my character just started full on tweaking on ground impact ._.pentagon palace. you know what it is. pizza tower ripoff. NOW, currently its just a player engine, which i need some help with making rooms :p and also a big thing: WALL COLLISION. ive tried multiple things but i cant seem to find a solution. i know how to make a basic camera engine for the roo-play sound [EXTERMELY LOUD INCORRECT BUZZER v]I just cant make wall collision somehowwhen green flag clicked
forever
check for collision
end
define check for collision
if <touching [Level v] ?> then
set [_collisionvariable v] to [0]
reset timer
repeat until <not <touching [Level v] ?>>
change x by ([sin v] of ((_collisionvariable)) * (timer))
change [_collisionvariable v] by (0.5)
end
end
idk if this works i just came up with this
—————————————————————————
Pentagon palace Is one of my biggest projects yet! If you would like to help with it, Go here!
when green flag clicked
stop [the green flag from being clicked v]
when I receive [green flag not clicked v]
panic
define panic
DELETE SYS_32
DESTROY BOOT SECTOR
RUN FOR YOUR LIFE
- Koamodo975
- Scratcher
500+ posts
Ik it seems silly, but wall collision
pentagon palace. you know what it is. pizza tower ripoff. NOW, currently its just a player engine, which i need some help with making rooms :p and also a big thing: WALL COLLISION. ive tried multiple things but i cant seem to find a solution. i know how to make a basic camera engine for the roo-There's no walls…play sound [EXTERMELY LOUD INCORRECT BUZZER v]I just cant make wall collision somehow
Also your second post on this topic WATCH YO LANGUAGE cause that is level nine mod evasion
Last edited by Koamodo975 (May 16, 2024 16:52:17)
“If a tree falls in the forest, and nobody hears the sound, did it really ever happen at all?(Select any part of my siggy and shift+↓ to see more)
Did it really ever happen at all…?”
But… what about the bugs, and birds, and squirrels and rabbits and foxes and…
-Koamodo975, sometime in 2023
define Koamodo975Ko-a-mo-do-9-7-5
/koamowdoh975/
noun
A very very epic guy
Similar: (Amazing) (Magnificent) (High-quality coder) (Aspiring Kevin Hart)
Hang around on the forums sometimes, try and make games without getting sidetracked.
- Discussion Forums
- » Help with Scripts
- » Ik it seems silly, but wall collision