Discuss Scratch

Foxi135
Scratcher
100+ posts

creating walls... pls help

so, i saw a few YT shorts from channel called “Project.JDM”, and one of them “bouncing square” got me thinking if i can turn it into a rhythm game. i still don't have data from my old laptop so i can't work on anything else. but im occurring a problem with wall generation. i have list with timing, i have list with directions in which it will bounce but i don't have walls. i figured i can draw lines, check intersections, create rectangles and exclude those that block the square. it turned out to work (so far), but:

it's so loooooooooooooooooooooooooong

basically the script above checks for collision between square and wall (rectangle).
square contains three values: x position, y position and size (8 pixels from center - very important)
and rectangle contains two points and points contain x and y position.

the problem is that those points are arranged randomly. one condition of the script above is:
((sx<rx1 and sx>rx2) or (sx>rx1 and sx<rx2))and((sy<ry1 and sy>ry2) or (sy>ry1 and sy<ry2))
and then one if block below:
((sx-8<rx1 and sx-8>rx2) or (sx-8>rx1 and sx-8<rx2))and((sy-8<ry1 and sy-8>ry2) or (sy-8>ry1 and sy-8<ry2))
and then:
((sx+8<rx1 and sx+8>rx2) or (sx+8>rx1 and sx+8<rx2))and((sy-8<ry1 and sy-8>ry2) or (sy-8>ry1 and sy-8<ry2))
and so on…
sx, sy - square x and y | rx1, ry1, rx2, ry2 - positions of two points creating rectangle

how can i shorten it?

Last edited by Foxi135 (May 8, 2023 13:54:24)

Newbies01
Scratcher
18 posts

creating walls... pls help

Is there any way you could allow me to see the code and test it?
I could try to help however I need to see the idea of what the code does.


==================================================================
Newbies01 (Coder)

Foxi135
Scratcher
100+ posts

creating walls... pls help

Newbies01 wrote:

Is there any way you could allow me to see the code and test it? …
sure https://scratch.mit.edu/projects/847396957/
good luck reading it!
Foxi135
Scratcher
100+ posts

creating walls... pls help

Bump
Foxi135
Scratcher
100+ posts

creating walls... pls help

bump
medians
Scratcher
1000+ posts

creating walls... pls help

Oh god

Also, I'm guessing the log thing is from forbidden word?
This code seems a bit repeated?

ignoring all of the stuff the converter added..
Is this supposed be 50 = 50? Seems like you don't really need that..

yeah I give up

Powered by DjangoBB