123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|51|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Python/Ruby -> Python Sprites

Wed, 29 Apr 2015, 08:18
Hotshot
I got myself Raspberry pi 2 and just need 32GB Mirco SD Card

I will be learning about Sprites on the screen then moving round

I learn from this one https://programarcadegames.com/

There is one things that I am stump on is that when I create folder where my code and images in the same folder. It always keep getting error saying it cant find my image!

for example

I decide have know name like background image instead of calling saturnfamily1.jpg!

background_image = pygame.image.load("background.jpg").convert()

What wrong with this one above!?
Wed, 29 Apr 2015, 08:21
Jayenkai
Is the compiler compiling to the same folder? And if not, does it copy the .jog image to the right folder?

-=-=-
''Load, Next List!''
Wed, 29 Apr 2015, 09:07
Hotshot
Is the compiler compiling to the same folder? Yes
does it copy the .jog image to the right folder? they all are in the same folder....

I think the reason why it got error is because I think the images is too big. The window I put is 800 x 600 where the images is 959 x 732.

I trying to resize the image in grafx2 but I cant seem find any icons that can resize the image!

I going have look gimp if they do it
Wed, 29 Apr 2015, 09:57
Hotshot
I have try Gimp 2.8 but graphics files is awful as they only save as

XCF Image files!

That suck!

I have notice you can do export files which is good...

I going post the code shortly
Wed, 29 Apr 2015, 10:01
Jayenkai
Nah, Gimp's better than that. Change the filetype in the file selector.

-=-=-
''Load, Next List!''
Wed, 29 Apr 2015, 10:13
Hotshot


I dont see anythings wrong with the code and graphics, sound, code all in the same folder but still get errors like

Traceback (most recent call last):
File "/home/pi/My Python/Game.py", line 25, in <module>
backgroundimage = pygame.image.load("background.png")
pygame.error: Couldn't open background.png
Wed, 29 Apr 2015, 10:15
Jayenkai
Im sorry, I honestly can't hazard a guess at what the issue might be. This is one of those "have to be there" issues.

-=-=-
''Load, Next List!''
Wed, 29 Apr 2015, 10:24
Hotshot
FInally got Images on screen !

I used Jpg for background and png for player

I think PNG is better where JPG is image can sometime be blur....
Wed, 29 Apr 2015, 11:45
rockford
If it's not the path, perhaps it was the case sensitivity of the image's name. Some languages and OSs require specific and exact case matching. Perhaps you tried to load "fred.png" but the file was called "fred.PNG"