Hey Russ I’m 13 trying to create apps early and your teaching is wonderful....your teaching me so much about coding and what you do for people is so kind and wonderful keep u the awesome work❤️❤️❤️
I was getting a little lost around 1-hour in. Then, you said it might make more sense if you ran the code, and the program hit an error immediately, so I got skeptical, but then your combination of print statements and examples really cleared the confusion. It was the part where you were correlating the mouse position to the tile grid, by the way.
Thanks a lot! I have completed this video too and I learn a lot again. You are really good at teaching. I am looking forward to finish the other tutorials
just completed ur pygame scrolling shooter game tutorial and im now here to learn how to make my own levels. man ur lessons are really great and is helping a lot of people most especially first timers like me. thanks russ!!!
@@CodingWithRuss I was wondering, how do i share my game to friends who dont have python installed? Is there a way for me to host it in a website so they can play it there? Would love to hear back from u
@@notnaix You can use pyinstaller to do that. I've only done it a couple times and it may take a bit of troubleshooting to get it to work but that's one way that I know of.
@@CodingWithRuss yep, I am using pyinstaller but I always get the error saying it failed to execute script. I’ll have to figure out how to get this to work
I have a question, every time I use button.Button(), it gives me this error AttributeError: module 'button' has no attribute 'Button', does somebody know how to fix this?
apparently a lot of the functions i am unable to say .draw, like save_button.draw(screen) or load_button.draw(screen) or i.draw etc Please help me fix this
bro holy shit your a beast , wtf thank u so much man im working on just practicing stuff and being able to make my own stuff too im just trying to aim for 10k hours of coding ive been going for about a month I started really basic stuff this stuff is great I found this from the platform game I only did the part 1 once I seen the level editor it looked very similar to code I did for a tic tac toe game and I looked back at it and realized I couldnt write it again without looking at anything so im gonna work on this I think then go back to the other vid
This is great! However i feel a bit sad that when i tried making something like this, from your previous level editor for the platformer game, i failed. So really what im doing is just using your code and adjusting it to my needs :(
Hey, I'm trying to make a Tapper clone, and I want to make a list of potential points in a grid, which is only a section of the screen, not the whole thing, where customers/patrons can spawn. So, how would I go about making this list or even a grid like that?
i.draw() didn't work for me. It gives this error AttributeError: module 'button. tasks' has no attribute 'draw'. anybody knows how to fix this problem?
Yea that should work. I tried to make the item boxes flexible so they could be any type of collectible item. You just need to code in your score counter so it increases when you collect that coin item box
hi I try to use your function for loading data so I write everything like you, but I got this error: world_data[x][y] = int(tile) IndexError: list index out of range
hello there! Really helpful tutorial...However when i try to create a health,grenade or an ammo box it shows them but they aren't actually created...Any solutions?
Hey I have a problem ...just tell me i have done everything like yours ...but cant convert it to csv file format.... I have resolved everything ...I have changed this to a level editor for any game ...it asks the bg and other imgs ...then generate to form cols and make an editor ...
Do you have/will you be making a video explaining how to assign properties to each tile such as collision, placing NPCs/enemies as tiles, and using tiles to designate a much larger sprite like a house or shop?
This editor does those things but in a simplified way. You can add tiles that can be used for collision and others that are for decoration, same with enemies. It doesn't have anything for buildings though, that could be a pretty useful feature if I was adapting this for an adventure/rpg game
@@CodingWithRuss Do you think you'll ever make a video adding buildings to the level editor like upgrade shops? One way I could think to do it is to have several tiles like a jigsaw puzzle and put them together on the tilemap and add a trigger that transitions to a shop level but that sounds really inefficient, especially when it comes to the inside of the shop
Hi, im using this level editor, but i want to change screen_width and screen_height to 1000. What else would i need to change so everything fits? (my tile sizes are 21x21 btw)
The main thing that matters is the number of rows and max_cols as that is how your data will be exported from the level editor into your game. So the rest of the sizes you can tweak to make it user friendly. The tile_size variable calculates automatically so you shouldn't need to change anything other than the screen_height and screen_width
@@CodingWithRuss thanks. Also, at line 37 (31:15) I’m trying to use the python formatting function, the f but I keep entering the normal f, not the squiggly one like yours. I think because of this I keep getting the “no such file or directory” error. How do I get the f to work? (Sorry for the simple questions, this is my first programming project 🙂)
@@aywhat.3133 You may be using an older version of python, which does not support f string formatting, which is what I am doing when I put an "f" at the start. Try updating your python installation and it should resolve it. Otherwise you can do it with the .format() method, but the way I have shown it is neater.
@@CodingWithRuss Yeah finally got the level editor to work completely. So how would i use it within the 2d platformer code? (i'm following your tile based platformer tutorial)
@@aywhat.3133 The tile based platformer had its own level editor, which was a bit more basic. You could try using this one by setting the rows and columns to 20 x 20 to match the platformer. And make sure the data is exported with pickle and not csv because the platformer is designed using pickle
Hello, I tried it but I have one problem.. The levels are in a csv format so I need a csv debugger but can't find one Are there any solutions for this?
You can open csv files with excel (if you are on windows). I think even notepad will open them. I'm not sure about iOS but there would be an equivalent.
@@CodingWithRuss i'm still confused as to where to get the button.py file, do i just follow your tutorial of this and save it as a separate file so i can import it to the main code? ua-cam.com/video/jyrP0dDGqgY/v-deo.html
Great tutorial! I have a question on switching between levels. When I switch to a new level to draw, it keeps the previous level layout. Is there a quick way to redraw a blank screen or do we need to erase everything first? EDIT: I did add a try statement to the load button as it would close the program out if I did not have a level for it saved. Only downside is it deletes the bottom layer so you have to do it by hand. But that is good for a water level lol.
Hmm that's a good point! I guess as I made this for my own use, some of the user friendliness didn't get prioritised :) Having a quick look at the code now, it may be simple enough to reset the world_data list when you change level numbers using the code between lines 58 to 66.
Thanks a lot! Had a few requests for this one so hopefully it is useful. I didn't think it would be as long as this though so I may need to split it into a few separate videos!
For me it works. UA-cam saves were I last watched your video. Of course splitting it up into parts maybe the way to go. Everytime I finished one of your tutorials I try to add my personal twist to it to better understand the code. How far do you think pygame can go when it comes to game development? Is it something that people might use for learning python or can it be something for publishing indie games?
@@burbulinadas12 I know there are some impressive looking games that have been made in pygame....like this Terraria clone: www.pygame.org/project/3451 so it is doable, but you have to make everything from scratch pretty much so I'm not sure it's a great choice for serious game dev. I actually got into it myself because I wanted to learn Python!
I made this for a specific game, which loads the data in and creates a level from it. You can see the code & tutorial for it here: ua-cam.com/video/DHgj5jhMJKg/v-deo.html
Hi! Very nice tutorial. I would like to load files whose names contain strings (i.e. 0A.png, B4.png and so on.) If I use img = pygame.image.load(f'[myfolder]/{x}.png') I get an error (FileNotFoundError: No such file or directory.). The solution could be renaming all of them only with an integer value (indeed it works) but I'd like to use their original names. I could achieve that? Thanks in advance.
Why over complicate something that works efficiently on its own. The image names don't show up on the screen anyway so it wont matter as the output would be the same. And the folders they are in help keep them tidy. Still, if you insist on wanting to name them, you could make an additional for loop and a dictionary. So first, in the dictionary u would load all the image names. Then you run a for loop for each of the items in that dictionary and then the output for each iteration of the loop would then become the variable we are using in this video ("X"). And you can't make it much more simpler than this if you want to have custom names of the images.
You mean the images? I downloaded them online for free. Or do you mean the software for creating the levels themselves? I made that myself, it's what this tutorial is for
YO whats up I have been Trying SO SO HARD asking So many people Made about 25 tickets in 5 different discord servers. Please can you make a video Of if a player moved then the tiles/ world will move So you can have a bigger word on a smaller Screen As I have seen you on this Video at the start. Or if you cant do that can you please add your code for that game in the link in your GitHub Please
@@CodingWithRuss Thank you SO much I am going back to school in 1 week So if you do relase it after a week I probs wont be able to watch it BUT it will AMAZING TO see how you do it. You should also make a discord Server Luv your Vids Keep it Up...
@@CodingWithRuss YOu do not know how long I have been trying to add a Camera I have joined like 15 discord servers 1000 Msges and about 50 dms to people And about 50 Code Backups I DONT GET HOW TO DO IT ANd its driving me INSANE If you know how to do it Please msg me on discord orangesidny#7030
Hey Russ, I've been following along with this tutorial for a while now, just wanted to give you kudos for putting this altogether! I have a question regarding a little bug I caught at ua-cam.com/video/xYhniILN6Ls/v-deo.html (1:03:42) whereby scrolling left will actually slightly overshoot from the editor grid - I just wanted to ask if you or anyone else have had the ability to crack that little bug (which I've found is only really due to changing the scrolling speed!) and if you could share how you solved it! I'll reply to this comment in case I find a solution myself.
Thanks William. Good catch on that scrolling bug. It's been a while since I made this one but I think a solution would be to add a check to see if the scroll variable has gone below 0, i.e. gone off the left side of the screen: In the section where the scrolling is done after line "scroll -= 5 * scroll_speed" add this: if scroll < 0: scroll = 0. You may need to do the same for the right hand side scrolling as well. This should fix it.
@@CodingWithRuss Cheers for getting back to me on this Russ, and very fair that it's been a while since you touched this. I've implemented a fix similar to that in my own version of this code, and I've been able to drill into the issue that it's a problem with the higher scroll speed (when holding down right shift). If the scroll value is of greater magnitude than the difference being tested for at the boundary (i.e. scroll is currently 5, and your next update to scroll will be -10), you will overstep the [0, MAX_COLS * TILE_SIZE] boundary. I'd have thought this was a problem I could address with forcing the scroll value to always be at the default scroll value when close to the boundaries, but none of my fixes have had the desired effect. Just sharing my findings in case anyone else is interested in this bounding problem 👍
File "/Users/ella/Desktop/NEA/Main game2.py", line 69, in img = pygame.image.load(f"set/{x}.png") FileNotFoundError: No file 'set/[{x}.png' found in working directory , this is the problem and i can't seem to fix it
Sometimes this happens if you are not running the program from the game folder. Go to File -> Open Folder and open the game folder, then try running it again and see if it works.
@@CodingWithRuss yep it works thank you but another problem came up stating pygame.draw.rect(screen, RED, button_list[current_tile].rect, 3) because the current tile is not defined
Hey Russ I’m 13 trying to create apps early and your teaching is wonderful....your teaching me so much about coding and what you do for people is so kind and wonderful keep u the awesome work❤️❤️❤️
Thanks a lot! I'm glad the videos are helping 🙂
Thank you so much for sharing! I've been trying to get into game development for the longest time. Seeing your videos gave me that final push.
Awesome, glad to hear it!
I was getting a little lost around 1-hour in. Then, you said it might make more sense if you ran the code, and the program hit an error immediately, so I got skeptical, but then your combination of print statements and examples really cleared the confusion. It was the part where you were correlating the mouse position to the tile grid, by the way.
you put a lot of time in this and I am grateful even when you C&P code you still explain you are defiantly a good teacher my friend
Thanks! much appreciated :)
Love the detail and structure in your explanations. Good job.
Thanks!
Thanks a lot! I have completed this video too and I learn a lot again. You are really good at teaching. I am looking forward to finish the other tutorials
just completed ur pygame scrolling shooter game tutorial and im now here to learn how to make my own levels. man ur lessons are really great and is helping a lot of people most especially first timers like me. thanks russ!!!
Awesome, glad to hear it is helping!
@@CodingWithRuss I was wondering, how do i share my game to friends who dont have python installed? Is there a way for me to host it in a website so they can play it there? Would love to hear back from u
@@notnaix You can use pyinstaller to do that. I've only done it a couple times and it may take a bit of troubleshooting to get it to work but that's one way that I know of.
@@CodingWithRuss yep, I am using pyinstaller but I always get the error saying it failed to execute script. I’ll have to figure out how to get this to work
Thanks a lot! I adapted this level editor to suit my needs and use it now, it's perfect.
Nice! I only really made this as a tool for my game so it's cool to see others are adapting it and modifying it for what they need
I have a question, every time I use button.Button(), it gives me this error AttributeError: module 'button' has no attribute 'Button', does somebody know how to fix this?
I have the same problem
same problem here. :(
have you created the button module to be imported?
a custom level editor gui, insane man! keep it up
Thanks!
Thank you Coding Whit Russ, your videos are a lot of help to me so.. Thank you!
Cheers :)
I love your videos! You are a great teacher. Thank you so much for sharing your knowledge.
Thanks a lot! Glad to hear these videos are helpful
proud moment when you realize his mistakes before he realizes " I am beginning to understand"
Amazingly easy to follow 👏
Thank you!
Thanks, glad you liked it!
This will be really useful! Thank you so much, love all your tutorials
Thanks a lot!
Luv your videos i watched ALL of it about 20 times
apparently a lot of the functions i am unable to say .draw, like save_button.draw(screen) or load_button.draw(screen) or i.draw etc
Please help me fix this
Yea that is a good idea you should add that Ross
tile_button = button.Button(SCREEN_WIDTH + (75 * button_col) + 50, 75 * button_row + 50, img_list[i], 1)
AttributeError: module 'button' has no attribute 'Button'. help pls
SAME PROBLEM
Hi. Great tutorial.
I just want to know if you can use levels created in this way for games created using languages different from python/pygame
Best game dev Tutorial, so inspiration.
Thanks! Glad it helped
I usually don't give likes but I give them to every video of this channel
Thanks a lot! :)
@@CodingWithRuss I have to thank you. Why don't you put a Donate Option at your GitHub, I'm sure some of your viewers will support you.
insane!
😁
I learnt a lot from this tutorial :) I will use your tips and tricks with my future programs. Thank you very much for this tutorial!
Glad to hear it was helpful! :)
bro holy shit your a beast , wtf thank u so much man im working on just practicing stuff and being able to make my own stuff too im just trying to aim for 10k hours of coding ive been going for about a month I started really basic stuff this stuff is great I found this from the platform game I only did the part 1 once I seen the level editor it looked very similar to code I did for a tic tac toe game and I looked back at it and realized I couldnt write it again without looking at anything so im gonna work on this I think then go back to the other vid
This is great! However i feel a bit sad that when i tried making something like this, from your previous level editor for the platformer game, i failed. So really what im doing is just using your code and adjusting it to my needs :(
Thanks! Yea that previous editor was a bit more basic so I had to start from scratch when i made this one.
Hey, I'm trying to make a Tapper clone, and I want to make a list of potential points in a grid, which is only a section of the screen, not the whole thing, where customers/patrons can spawn. So, how would I go about making this list or even a grid like that?
Thank You,
You're an Excellent teacher. Easy to understand and follow.
Thanks! :)
i.draw() didn't work for me. It gives this error AttributeError: module 'button. tasks' has no attribute 'draw'. anybody knows how to fix this problem?
SAME PROBLEM HEEELP ME
At 35:00 it says module button has no attribute ‘Button’ can you help me
hello, what if i want to make a boss that is bigger than one tile
question if i add another class ( collecting coins and with the counter on the screen ) can i use the item box just add as another 'box' ???
Yea that should work. I tried to make the item boxes flexible so they could be any type of collectible item. You just need to code in your score counter so it increases when you collect that coin item box
AttributeError: module 'button' has no attribute 'Button' can you help me ?
You have to download the button.py code from the github link
please help me my computer showed error "window is show large"
Thank you sir for your new tutorial.
You're welcome, hope it is useful!
Thanks for tutorial, amazing ....🥰🥰🥰
Glad you liked it :)
how do I put the folders in? in what order pls get back to me
Like not just move the Background but be able to move the Tiles as well
Thanks a lot for the tutorial, i made my own levels with the help of your level editor but how can i use the map i made for my actual game?
hi I try to use your function for loading data so I write everything like you, but I got this error:
world_data[x][y] = int(tile)
IndexError: list index out of range
hello there! Really helpful tutorial...However when i try to create a health,grenade or an ammo box it shows them but they aren't actually created...Any solutions?
Sir, currently we are working with square tiles, how to work with angular tiles, like edges of ground or ramps which are bottom half of a square
I could not find that in the Video
Or i mist it please can you add a Time Stamp for it
hey its showing button module has no attribute Button...pls tell I am so tensed
Im pretty sure he said in the video he made a tutorial on making that module, it doesn't already exist im not sure if that helps though
Hey I have a problem ...just tell me i have done everything like yours ...but cant convert it to csv file format....
I have resolved everything ...I have changed this to a level editor for any game ...it asks the bg and other imgs ...then generate to form cols and make an editor ...
Thanks brother!
No problem!
Do you have/will you be making a video explaining how to assign properties to each tile such as collision, placing NPCs/enemies as tiles, and using tiles to designate a much larger sprite like a house or shop?
This editor does those things but in a simplified way. You can add tiles that can be used for collision and others that are for decoration, same with enemies. It doesn't have anything for buildings though, that could be a pretty useful feature if I was adapting this for an adventure/rpg game
@@CodingWithRuss Do you think you'll ever make a video adding buildings to the level editor like upgrade shops? One way I could think to do it is to have several tiles like a jigsaw puzzle and put them together on the tilemap and add a trigger that transitions to a shop level but that sounds really inefficient, especially when it comes to the inside of the shop
ive downloaded the button but when i import it doesn't work?
Hi, im using this level editor, but i want to change screen_width and screen_height to 1000. What else would i need to change so everything fits? (my tile sizes are 21x21 btw)
The main thing that matters is the number of rows and max_cols as that is how your data will be exported from the level editor into your game. So the rest of the sizes you can tweak to make it user friendly. The tile_size variable calculates automatically so you shouldn't need to change anything other than the screen_height and screen_width
@@CodingWithRuss thanks. Also, at line 37 (31:15) I’m trying to use the python formatting function, the f but I keep entering the normal f, not the squiggly one like yours. I think because of this I keep getting the “no such file or directory” error. How do I get the f to work? (Sorry for the simple questions, this is my first programming project 🙂)
@@aywhat.3133 You may be using an older version of python, which does not support f string formatting, which is what I am doing when I put an "f" at the start. Try updating your python installation and it should resolve it. Otherwise you can do it with the .format() method, but the way I have shown it is neater.
@@CodingWithRuss Yeah finally got the level editor to work completely. So how would i use it within the 2d platformer code? (i'm following your tile based platformer tutorial)
@@aywhat.3133 The tile based platformer had its own level editor, which was a bit more basic. You could try using this one by setting the rows and columns to 20 x 20 to match the platformer. And make sure the data is exported with pickle and not csv because the platformer is designed using pickle
Hello.. please .. for import button it says there is no such module - no module named "button" how is that?
Did you download the separate python file called "button.py" from the github link?
@@CodingWithRuss Oh.. noo.. thats the thing.. Thank you
Hello, I tried it but I have one problem..
The levels are in a csv format so I need a csv debugger but can't find one
Are there any solutions for this?
You can open csv files with excel (if you are on windows). I think even notepad will open them. I'm not sure about iOS but there would be an equivalent.
how i can write to txt file without commas? only numbers like this 00001110000... ?
Thank you soo soo much dude You just got a sub
Cheers!
i'm getting an AttributeError: module 'button' has no attribute 'Button'
every time i do the tile_button = button.Button line
how can i fix this?
Sounds like it can't find the file. Make sure the button.py file is in the same folder as your main code.
@@CodingWithRuss i'm still confused as to where to get the button.py file, do i just follow your tutorial of this and save it as a separate file so i can import it to the main code?
ua-cam.com/video/jyrP0dDGqgY/v-deo.html
@@nayunayu4265 It's on my github repository for this project. Should be linked in the video description
Great tutorial! I have a question on switching between levels. When I switch to a new level to draw, it keeps the previous level layout. Is there a quick way to redraw a blank screen or do we need to erase everything first? EDIT: I did add a try statement to the load button as it would close the program out if I did not have a level for it saved. Only downside is it deletes the bottom layer so you have to do it by hand. But that is good for a water level lol.
Hmm that's a good point! I guess as I made this for my own use, some of the user friendliness didn't get prioritised :)
Having a quick look at the code now, it may be simple enough to reset the world_data list when you change level numbers using the code between lines 58 to 66.
@@CodingWithRuss Awesome, that works! Thanks!
Ahh, so when scrolling we don’t change the camera. Rather we change position of everything else.
Another good one buddy! Thank you so much.
Thanks a lot! Had a few requests for this one so hopefully it is useful. I didn't think it would be as long as this though so I may need to split it into a few separate videos!
For me it works. UA-cam saves were I last watched your video.
Of course splitting it up into parts maybe the way to go.
Everytime I finished one of your tutorials I try to add my personal twist to it to better understand the code.
How far do you think pygame can go when it comes to game development? Is it something that people might use for learning python or can it be something for publishing indie games?
@@burbulinadas12 I know there are some impressive looking games that have been made in pygame....like this Terraria clone: www.pygame.org/project/3451 so it is doable, but you have to make everything from scratch pretty much so I'm not sure it's a great choice for serious game dev. I actually got into it myself because I wanted to learn Python!
How do i use this code for the platformer game
thank for all video
what the software you use to create platforme
thank you for your answer
I use sublime text
Sir which IDE are you using for coding??
I use sublime text editor
Really useful video
Thanks!
i had a question; how do i load this data into a game (the images and their pos)
I made this for a specific game, which loads the data in and creates a level from it. You can see the code & tutorial for it here: ua-cam.com/video/DHgj5jhMJKg/v-deo.html
iv watched most of this and still watching, Is there a way to put all your own title in the Level editor?
Yea sure, you can replace the images in the folder with your own ones
Dude, thank you so much!
You're welcome!
This is just amazing!
Hi! Very nice tutorial.
I would like to load files whose names contain strings (i.e. 0A.png, B4.png and so on.)
If I use img = pygame.image.load(f'[myfolder]/{x}.png') I get an error (FileNotFoundError: No such file or directory.).
The solution could be renaming all of them only with an integer value (indeed it works) but I'd like to use their original names.
I could achieve that? Thanks in advance.
Why over complicate something that works efficiently on its own. The image names don't show up on the screen anyway so it wont matter as the output would be the same. And the folders they are in help keep them tidy.
Still, if you insist on wanting to name them, you could make an additional for loop and a dictionary. So first, in the dictionary u would load all the image names.
Then you run a for loop for each of the items in that dictionary and then the output for each iteration of the loop would then become the variable we are using in this video ("X").
And you can't make it much more simpler than this if you want to have custom names of the images.
Amazing Content!🤗
Amazing vid but can someone tell me what the code for the button class is?🤔
Did you find it? It's on github with the main code
14:29 You can just say if scroll_left:
Thank you!! keep it up!!
Thanks, I will :)
Cara sou brasileiro não entendo muito bem o ingles mas seu video foi tao bom que eu consegui entender o tutorial!
Thank YOU!!!!!
You're welcome!
Can u tell me why u use pygame instead of unity?
I wanted to learn Python and I like making games so that's why I went with PyGame. I would like to try Unity at some point though
Your an awesome person what you do is amazing.....I’m having a little problem with importing button though and I have downloaded it
nevermind i got it to work :)
Glad to hear it. That was quick! :)
Sorry, I asked the wrong question.
I’m talking about the software for creating tilemaps.
the same as you.
sorry for the disturbance
You mean the images? I downloaded them online for free.
Or do you mean the software for creating the levels themselves? I made that myself, it's what this tutorial is for
how to use his tilemap
How do you play the level?
The level editor makes levels for my shooting game, which is in another tutorial: ua-cam.com/video/DHgj5jhMJKg/v-deo.html
YO whats up
I have been Trying SO SO HARD
asking So many people
Made about 25 tickets in 5 different discord servers.
Please can you make a video
Of if a player moved then the tiles/ world will move
So you can have a bigger word on a smaller
Screen As I have seen you on this Video at the start.
Or if you cant do that can you please add your code for that game in the link in your GitHub Please
Hi, sure that is a feature in the game I am currently making and I will be uploading the tutorials for that soon!
@@CodingWithRuss Thank you SO much
I am going back to school in 1 week
So if you do relase it after a week
I probs wont be able to watch it
BUT it will AMAZING TO see how you do it.
You should also make a discord Server
Luv your Vids Keep it Up...
@@CodingWithRuss I am Subed Btw
Sorry I forgot to do that
@@orangesidny Thanks! :)
@@CodingWithRuss YOu do not know how long I have been trying to add a Camera
I have joined like 15 discord servers 1000 Msges and about 50 dms to people
And about 50 Code Backups
I DONT GET HOW TO DO IT
ANd its driving me INSANE
If you know how to do it
Please msg me on discord
orangesidny#7030
Please you do not know how useful it would be
Hey Russ, I've been following along with this tutorial for a while now, just wanted to give you kudos for putting this altogether!
I have a question regarding a little bug I caught at ua-cam.com/video/xYhniILN6Ls/v-deo.html (1:03:42) whereby scrolling left will actually slightly overshoot from the editor grid - I just wanted to ask if you or anyone else have had the ability to crack that little bug (which I've found is only really due to changing the scrolling speed!) and if you could share how you solved it!
I'll reply to this comment in case I find a solution myself.
Thanks William. Good catch on that scrolling bug. It's been a while since I made this one but I think a solution would be to add a check to see if the scroll variable has gone below 0, i.e. gone off the left side of the screen:
In the section where the scrolling is done after line "scroll -= 5 * scroll_speed" add this:
if scroll < 0:
scroll = 0.
You may need to do the same for the right hand side scrolling as well. This should fix it.
@@CodingWithRuss Cheers for getting back to me on this Russ, and very fair that it's been a while since you touched this.
I've implemented a fix similar to that in my own version of this code, and I've been able to drill into the issue that it's a problem with the higher scroll speed (when holding down right shift).
If the scroll value is of greater magnitude than the difference being tested for at the boundary (i.e. scroll is currently 5, and your next update to scroll will be -10), you will overstep the [0, MAX_COLS * TILE_SIZE] boundary.
I'd have thought this was a problem I could address with forcing the scroll value to always be at the default scroll value when close to the boundaries, but none of my fixes have had the desired effect.
Just sharing my findings in case anyone else is interested in this bounding problem 👍
File "/Users/ella/Desktop/NEA/Main game2.py", line 69, in
img = pygame.image.load(f"set/{x}.png")
FileNotFoundError: No file 'set/[{x}.png' found in working directory , this is the problem and i can't seem to fix it
Sometimes this happens if you are not running the program from the game folder. Go to File -> Open Folder and open the game folder, then try running it again and see if it works.
@@CodingWithRuss yep it works thank you but another problem came up stating pygame.draw.rect(screen, RED, button_list[current_tile].rect, 3) because the current tile is not defined
@@mojimoose9464 That's odd. What timestamp in the video did you get the error?
@@CodingWithRuss 43:12
@@mojimoose9464 Did you define the variable first? Take a look at 41:30 onwards
Why does it give an error "AttributeError: module 'button' has no attribute 'Button' " and how to fix it if the button library is added and imported?
how do i fix this error bro?? tyy
module 'button' has no attribute 'Button'
Thank you !!