#๐Ÿ”’ for some reason, even when i define surface, and it draws, i still get a black screen

74 messages ยท Page 1 of 1 (latest)

full copperBOT
#

@mossy radish

Python help channel opened

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.

#
Pasting large amounts of code

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.

halcyon cloak
#

lets see

#

and the error

#

share with me the assets you have and ill run the code on my end

#

if the screen is black you are not updating the screen. thats all there is. and i have not read your code i have just went to the line where you have the error

#

share your code and assets you use so i can run the code on my machine

#

assets means the things you use for your game, images, sound, movies, music, etc

#

i have the code, but yes, i need the sprites as well, and anything else you use for assets

#

you share the images

#

you can use this channel

#

or github

#

names correct?

#

alright.. so inside your main game loop

#

you draw your screens background with white

#

agree @mossy radish ?

#

and i see that you alreayd have made your surface previous and called it screen so you dont need another copy of your display_surface

#

now you only need all_sprites.draw(screen)

#

instead

#

next, do you have a clock to manage your ingame timings?

#
do game logic
draw things on screen
update screen
use the clock to handle tick timings
#

these are the things you need to do

#

and most of the code is game logic but the three other things are important to see something on your screen

#

if you add the two missing parts, it will look like this

#

to your surface

#

you have already made it, you called it screen and you made it again when i asked about it, and called it display_surface

#

you can just use screen instead, you have already made it

#

the two parts you are missing is updating the screen/display, and use the clock to manage the tick timing

#

please add those changes and show me what you have... its all in the #Drawing part of your code

#

it is sensible to use white until you see it working

#

and change it later

#

what makes you think that is a good idea?

#

who is going to play your game? you or the computer?

#

alright.. so how fast do you think the computer is able to do the calculations you want?

#

lets say, your game needs to do 1_000_000 calculators, how fast can the computer do that?

#

no, a few milliseconds

#

so if you dont limit how fast the computer is, you will not be able to play the game, it will go to fast

#

yes

#

you need a clock to handle this, so you cant remove it, you have to use it

#

these are the things you need

#

if you dont have this, you will not be able to see anything on your screen

#

so add them please

#

let me know when you have, and share what you have done

#

no, i wrote them using human language, you can see that because its written in English and not in Python

reef parcel
halcyon cloak
#

what part are you trying to add? update the display/screen?

#

because you have already drawn things to the screen right?

#

pygame.display.update() this is how you update the display after each time you have drawn things to it

#

and if you want to update the game 60 times pr second, you add clock.tick(60)

#

like so

#

show your code

full copperBOT
#
Pasting large amounts of code

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.

halcyon cloak
#

your not updating the display

#

and you have not removed the display_surface line, you dont need that when you already have screen created

#

in other worrds, this is not the same as I did and showed in code

full copperBOT
#
Pasting large amounts of code

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.

halcyon cloak
#

thats just incorrect game logic, you have to look into that yourself.. but now you have things on your screen?

#

there you go

#

what did you learn from this?

#

yes

#

and after you have drawn, what do you need to do actually see what you have drawn?

#

corect

#

good!

#

have a great day!

#

you can close this channel with !close when you are done with it

full copperBOT
#
Python help channel closed

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.