#๐ problems in beginnner's code
77 messages ยท Page 1 of 1 (latest)
@bold rose
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!pastebin if the code/error is too long @bold rose
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
if you're trying to share files, you can't.
no it doesn't
^
nice
no errors
ok
when i launch the code:
-the first block dissapears after you place it
-the block you are currently placing has a copy of it and its overlaping
it's a pretty long code so if you're not sharing what the problem is it would be very hard to spot it like that
thats the first block
when i place it this happens
the first block i placed dissapears and the next one i gets a copy of it
when i place those blocks, all blocks, except for one that dissapeared starts moving
and the previous copy dissapears too
the only block that stops is the red one at the beginning
but it disappears for some reason
new block is placed with down key right?
I don't know if this is the issue, but new_block = blocks[-1] doesn't make a copy. That makes that refer to the other block.
with a space bar
changing it?
yes and then you also add a copy of it to the lisg
wait I'll show
else:
new_block = blocks[-1]
new_block.y -= 20
new_block.color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
new_block.speed += 0.5
blocks.append(Block(0, new_block.y, new_block.width, new_block.height, new_block.color, new_block.speed))
score += 1 ```
this else block runs when there are 1 or less blocks
so it will always run at the start
the first line takes the initial block and calls it "new_block"
blocks = [initial_block]
oh i get it now
this is the same as saying new_block = initial_block
i did something wrong again
blocks stop now
the second one dissapears now
and there is a moving copy instead
and its impossible to lose the game now
blocks get smaller for every part you miss, like intended
but if you miss while placing the block the game continues on
like so
@random coral i ask your assistance
lend me your help
i guess this post is not relevant anymore, since its old
give a minute hehe
no worries
without looking at the code I can see that the collision checking only works partly. it places it on the correct height but it it doesn't check the horizontal collision
so make sure to check horizontal overlap as well
that invisible block is pretty weird, it might take me a while to find this bug
now it does
maybe the 2nd blocks state is not handled or displayed correctly
the clone of the block is still appearing while placing
the second block, doesnt have a copy
until its gone
the following blocks have a copy
can you update the code
sure
doesn't work
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ problems in beginnner's code