first commit

This commit is contained in:
cscough 2026-01-19 17:54:17 -05:00
commit edbcd1e394
67 changed files with 3850 additions and 0 deletions

BIN
1VBS/Computer.lnk Normal file

Binary file not shown.

10
1VBS/Computer.vbs Normal file
View File

@ -0,0 +1,10 @@
x = MsgBox("Computer is not responding",16,"Error")
x = MsgBox("Would you like to shutdown?",vbYesNo+vbInformation,"Error")
if x =6 then
yes = MsgBox("Sutting down.",48,"Shutdown Error")
run shutdown.bat
End if
if x =7 then
no = MsgBox("Are you sure? If you don't turn off the computer you could lose any unsaved files.",32,"Are you sure?")
end if

5
1VBS/Computerprank.vbs Normal file
View File

@ -0,0 +1,5 @@
x = MsgBox("Computer is not responding",16,"Error")
x = MsgBox("How is that OK?",16,"Error")
x = MsgBox("Dude, your Computer is not responding!",16,"Error")
x = MsgBox("Close me again and I'll give you a virus!",16,"Error")
x = MsgBox("You have a Virus",16,"dumb ass")

18
1VBS/VBSexample.bat Normal file
View File

@ -0,0 +1,18 @@
echo off
color 1a
cls
echo x = MsgBox("TEXT",number for icon,"TITLE")
echo 0 ok button
echo 1 ok and a cancel button
echo 2 abort, retry, and ignore buttons
echo 3 yes, no, and cancel buttons
echo 4 yes and no buttons
echo 5 retry and cancel buttons
echo 6-15 ok button
echo 16 an icon of a ERROR sign, a circle with a cross on it and a ok button
echo 32 an icon of a QUESTION mark sign "?"
echo with a ok button
echo 48 an icon of a WARNING sign, a triangle with a "!" on it and a ok button
echo 64 is a information sighn
echo for coding in VBS
pause

12
1VBS/VBSexample2.vbs Normal file
View File

@ -0,0 +1,12 @@
Dim box, yes, no
box = MsgBox("press a button and i will tell you what it is",4,"miutubevids")
If box =6 Then
yes = MsgBox("you pressed yes because in the script it ses 6 and if you look in the description it ses 6 = yes",48,"miutubevids")
End if
If box =7 Then
no = msgbox("you pressed no because in the script it ses 7 and if you look in the description it ses 7 = no",48,"miutubevids")
End If

20
1VBS/test.html Normal file
View File

@ -0,0 +1,20 @@
<html>
<head>
<title>Testing</title>
</head>
<body bgcolor="black" text="white">
<ul>
<li>
stuff
</li>
<li>
stuff
</li>
<li>
stuff
</li>
<li>
stuff
</li>
</ul>
</html>

BIN
ESCAPE/ESCAPE.lnk Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 MiB

View File

@ -0,0 +1,79 @@
:back2
echo off
color 89
cls
echo -door
echo -table
set /p MOVE2= use scissors on what?
goto %MOVE2%
:door
cls
echo off
color 84
echo "you unlocked the door, but you cut your hand."
pause
goto continue
:table
echo off
color 84
cls
echo "congradulations, you scratched the table"
pause
cls
goto back2
:continue
echo off
color 89
cls
echo "You continue to the hallway, your hand bleeding badly."
echo.
echo -go left
echo -travel right
set /p MOVE3=what would you like to do?
goto %MOVE3%
:go left
:travel right
echo off
color C0
cls
echo You travel down the hallway, you're gushing blood.
echo off
ping 123.45.67.89 -n 1 -w 3000 >nul
color C0
echo you cant help but wonder why it seems like you aren't getting anywhere.
echo off
ping 123.45.67.89 -n 1 -w 3000 >nul
color 40
echo you look down at your feet and start to feel woozy.
echo off
ping 123.45.67.89 -n 1 -w 3000 >nul
color 08
echo your eyes go dark
echo off
ping 123.45.67.89 -n 1 -w 3000 >nul
color 08
cls
echo.
echo.
echo.
echo.
echo.
pause
goto game over
:game over
echo off
color 4
cls
echo GAME OVER
echo.
echo you died at: %TIME%
echo on: %DATE%
echo.
echo.
pause
call ^\ESCAPE\GAMEDATA\ESCAPE.bat

156
ESCAPE/GAMEDATA/ESCAPE.bat Normal file
View File

@ -0,0 +1,156 @@
:start
@echo off
mode con cols=160 lines=62
color 75
cls
echo WELCOME TO ESCAPE
echo.
echo.
echo.
echo created by: Curtis Coughenour
pause>nul
ping 123.45.67.89 -n 1 -w 3 >nul
echo off
color 0A
cls
echo _____________________________
echo /
echo _____________________________
ping 123.45.67.89 -n 1 -w 3 >nul
cls
echo _____________________________
echo //
echo _____________________________
ping 123.45.67.89 -n 1 -w 3 >nul
cls
echo _____________________________
echo ///
echo _____________________________
ping 123.45.67.89 -n 1 -w 3 >nul
cls
echo _____________________________
echo ////
echo _____________________________
ping 123.45.67.89 -n 1 -w 3 >nul
cls
echo _____________________________
echo /////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5 >nul
cls
echo _____________________________
echo //////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5 >nul
cls
echo _____________________________
echo ///////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5 >nul
cls
echo _____________________________
echo ////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5 >nul
cls
echo _____________________________
echo /////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5 >nul
cls
echo _____________________________
echo /////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5 >nul
cls
echo _____________________________
echo //////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 500 >nul
cls
echo _____________________________
echo ///////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 3000 >nul
cls
echo _____________________________
echo //////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 5000 >nul
cls
echo _____________________________
echo ///////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 2000 >nul
cls
echo _____________________________
echo ////////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 50 >nul
cls
echo _____________________________
echo /////////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 50 >nul
cls
echo _____________________________
echo //////////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 1 >nul
cls
echo _____________________________
echo ///////////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 1 >nul
cls
echo _____________________________
echo ////////////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 2 >nul
cls
echo _____________________________
echo /////////////////////////////
echo _____________________________
ping 123.45.67.89 -n 1 -w 500 >nul
echo loading complete
ping 123.45.67.89 -n 1 -w 500 >nul
:inp
echo off
color 75
cls
echo -start
echo -quit
echo.
set /p PROGRAM= What would you like to do?:
if %PROGRAM%== start call PART1.bat
if %PROGRAM%== quit exit
if not %PROGRAM%== start goto INV
:INV
echo off
color 75
cls
echo Invalid Input
ping 123.45.67.89 -n 1 -w 1000 >nul
goto inp

676
ESCAPE/GAMEDATA/PART1.bat Normal file
View File

@ -0,0 +1,676 @@
:start
:back
echo off
color 9
cls
echo You are in a dark room, there is a table with a lamp on it to your left and a door to your right
echo.
echo -use lamp
echo -open door
set /p MOVE=what do you want to do?
goto %MOVE%
:use lamp
:back3
cls
echo off
color 79
echo the lamp is now on
echo.
echo The room is small and has no windows. on the table you notice some scissors and across the room there is a wardrobe
echo -use scissors
echo -search wardrobe
set /p MOVE1=what do you want to do?
goto %MOVE1%
:open door
echo off
color 84
cls
echo the door is locked.
pause
cls
goto back
:use scissors
call 1/PART1A.bat
pause
:search wardrobe
cls
echo You found a crowbar!
echo -use crowbar
echo -return
set /p MOVE4=what would you like to do?
goto %MOVE4%
:return
echo off
cls
goto back3
:use crowbar
echo off
color 89
cls
echo You pried the door open with the crowbar!
pause
goto continue
:continue
echo off
color 89
cls
echo You are now in the hallway, it is long and dark.
echo -go left
echo -travel right
set /p MOVE3=what would you like to do?
goto %MOVE3%
:go left
:back4
echo off
color 89
cls
echo You go left and find a door to your left, one to your right and one at the end of the hall
echo -left door
echo -right door
echo -end of the hall
echo -go back
set /p MOVE5=where would you like to go?
goto %MOVE5%
:left door
echo off
color 84
cls
echo You are about to open the door, but when you step toward it, it shakes violently and growls.
echo The floor shakes and the door raddles. You don't dare go near it.
pause
goto 2
:2
echo off
color 89
cls
echo You go left and find a door to your left, one to your right and one at the end of the hall
echo -left
echo -right
echo -end of hall
echo -back
set /p MOVE5=where would you like to go?
if %MOVE5%== left goto die
if %MOVE5%== right goto 3
if %MOVE5%== end goto end of the hall
if %MOVE5%== back goto go back
if not %MOVE5%== left echo invalid input
pause
cls
goto 2
:right door
:3
echo off
color 89
cls
echo The door is locked, but it looks like you can use a key on it, so you go back to the hallway
pause
goto continue
:end of the hall
echo off
color 84
cls
echo "this door is locked"
pause
goto back4
:die
echo off
color 4
cls
echo You dare go near, fear does not effect you! You man up, brace yourself for the worst, and slowly grab the door handle.
echo As you turn the knob, the door busts open! You are attacked and fall to the ground. *BAM*
pause
goto game over
:go back
echo off
color 84
cls
echo You go back only to find that you are lost. How can this be? you only traveled in a straight line... Then it his you *bam*
pause
goto game over
:travel right
echo off
color 89
cls
echo You find a door to your left and what appears to be a sealed off broken stairwell
echo -search room
echo -look in stairwell
echo -go back
set /p MOVE6=what would you like to do?
goto %MOVE6%
:look in stairwell
echo off
color 84
cls
echo The door to the stairwell is locked, but you can see through the window on the door. The stairwell appears to be destroyed and not usable.
pause
goto travel right
:search room
echo off
color 89
cls
echo You look in the room only to realize it was a torture chamber. There is blood all over the floor and it looks recent.
echo There is a bucket in the corner."
echo -search bucket
echo -leave
set /p MOVE7=what would you like to do?
goto %MOVE7%
:leave
:back5
echo off
color 84
cls
echo You turn around to leave the room, but the door is shut and locked behind you. The lights go out and then it hits you. *BAM*
pause
goto game over
:search bucket
echo off
color 89
cls
echo You look in the bucket, it is filled with blood and body parts. As you reach in, the body parts start moving.
echo You decide to just get it over with and search the bucket anyway... You found a key! This may be useful.
pause
goto key
:key
echo off
color 89
cls
echo You go down to the other side of the hallway and decide to try the doors
echo -left door
echo -front door
echo -right door
set /p MOVE8=which door would you like to try?
goto %MOVE8%
:front door
:left door
echo off
color 84
cls
echo The key does not work on this door
pause
goto key
:right door
echo off
color 89
cls
echo You opened the door with the key! The hallway in front of you appears dark and long.
echo -hallway
echo -back
set /p MOVE9=where would you like to go?
if %MOVE9%== hallway goto down hallway
if %MOVE9%== back goto back5
:down hallway
echo off
color 89
cls
echo You travel down the hallway for what feels like hours. It seems like it never ends. You finally come across two rooms.
echo Both of them have light emitting from them. The one to the left appears to be a bathroom and the one to the right is a bedroom.
echo -save game in bedroom
echo -use bathroom
set /p MOVE10=what would you like to do?
goto %MOVE10%
:save game in bedroom
echo off
color 1A
cls
echo save game key is "save1"
pause
goto use bathroom
:use bathroom
:save1
echo off
color 89
cls
echo You look in the bathroom and find three stalls and two broken sinks.
echo -stall1
echo -stall2
echo -stall3
set /p MOVE11=Which stall would you like to search?
goto %MOVE11%
:stall1
echo off
color 84
cls
echo You open the stall to the left only to find a toilet filled with blood and body parts.
pause
goto save1
:stall2
echo off
color 84
cls
echo You open the stall in the middle and as the door creaks open you spot something dark and scaly slide into the toilet.
echo You slam the door shut.
pause
goto save1
:stall3
echo off
color 89
cls
echo You open the stall to the right in the corner and you are surprised to see that there is no toilet, but a hole in the wall.
echo It seems like a long and dark hallway.
echo -hallway
echo -leave bathroom
set /p MOVE12=where would you like to go?
goto %MOVE12%
:leave bathroom
echo off
color 84
cls
echo You turn around to leave the bathroom and as you walk toward the door you realize, there is no door!
echo The sinks turn on and ooze blood rather than water. The lights go out *BAM*
pause
goto game over
:hallway
echo off
color 89
cls
echo You travel down the hallway. It gets darker as it seems endless. Eventually you come across a box of matches on the ground.
echo -matches
echo -continue
set /p MOVE13= what would you like to do?
if %MOVE13%==continue goto continue2
if %MOVE13%==matches goto matches
:continue2
echo off
color 84
cls
echo You keep walking and walking for a very long time. You cant see anything until you run into a wall.
echo You back up and see a large flash of light
ping 123.45.67.89 -n 1 -w 7000 >nul
echo off
color FE
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
ping 123.45.67.89 -n 1 -w 500 >nul
goto game over
:matches
echo off
color 79
cls
echo You continue down the hallway with the matches, lighting one every few seconds because they dont last long at all.
ping 123.45.67.89 -n 1 -w 7000 >nul
echo off
color 89
echo You notice the hallway getting narrower. You notice the walls arent stone, but in fact...
ping 123.45.67.89 -n 1 -w 7000 >nul
echo off
color 84
cls
echo bone
ping 123.45.67.89 -n 1 -w 3000 >nul
:matches2
echo off
color 79
cls
echo You continue down the narrow catacombs, the walls ooze with blood. You travel for a long time only to come across what seems
ping 123.45.67.89 -n 1 -w 2000 >nul
echo off
color 89
ping 123.45.67.89 -n 1 -w 1000 >nul
echo off
color 79
echo like a very dark maze. 'Oh god' you think as you dread the decisions of making a left or a right.
echo -maze
echo -hall
set /p MOVE14=what would you like to do?
goto %MOVE14%
:hall
echo off
color 4
cls
echo You turn around to go back to the bathroom and... *BAM*
pause
goto game over
:cheat
echo off
color 89
cls
START 1\2\3\4\5\CHEAT\maze.png
goto matches2
:maze
echo off
color 89
cls
echo -straight
echo -right
set /p MOVE15=where would you like to go?
goto %MOVE15%
:straight
echo off
color 84
cls
echo "this is a dead end"
pause
goto maze
:right
:4
echo off
color 89
cls
echo You travel down a long hallway
echo.
echo -straight
echo -left
set /p MOVE16=where would you like to go?
if %MOVE16%== straight goto a
if %MOVE16%== left goto b
:a
echo off
color 84
cls
echo "this is a dead end"
pause
goto 4
:b
echo off
color 89
cls
echo You go left
echo -right
echo -straight
set /p MOVE17=where would you like to go?
if %MOVE17%== straight goto c
if %MOVE17%== right goto d
:c
echo off
color 84
cls
echo "this is a dead end"
pause
goto b
:d
echo off
color 89
cls
echo You turn right and go down a hallway to your left and come to a T
echo.
echo -left
echo -right
set /p MOVE18=where would you like to go?
if %MOVE18%== left goto e
if %MOVE18%== right goto E1
:E1
echo off
color 84
cls
echo You go right and travel down a long hallway. At the end of the hallway there is a room.
echo.
echo -room
echo -back
set /p MOVE19=where would you like to go?
if %MOVE19%== room goto DeadA
if %MOVE19%== back goto d
:DeadA
echo off
color 84
cls
echo The room is well lit, lights everywhere.
ping 123.45.67.89 -n 1 -w 3000 >nul
echo off
color 74
echo They are hot lights, the heat is almost unbarable.
ping 123.45.67.89 -n 1 -w 3000 >nul
echo off
color F4
echo You turn around to leave the room, but you can't see the door.
ping 123.45.67.89 -n 1 -w 3000 >nul
echo off
color F6
echo The lights are too bright, and they're getting brighter...
ping 123.45.67.89 -n 1 -w 3000 >nul
echo off
color FE
echo The heat is increasing, you scream for help as you slowly cook to death.
pause
goto game over
:e
echo off
color 89
cls
echo You go left and end up in a large hallway. There is an open door to your right and a nerrow hall to your left.
echo -left
echo -right
set /p MOVE20=where would you like to go?
if %MOVE20%== left goto deadB
if %MOVE20%== right goto f
:deadB
echo off
color 84
cls
echo You travel down a hallway that seems like a spiral. At the end of the spiral, there is just a wall.
echo A dead end. You turn around to go back, but there is no back. It's a room now, rather than a hallway. The walls close in." *BAM*
pause
goto game over
:f
echo off
color 89
cls
echo You go right and there is another T. It is so dark that you can't see five feet in front of you.
echo -left
echo -right
set /p MOVE21=Where would ou like to go?
if %MOVE21%== left goto H1
if %MOVE21%== right goto h
:H1
echo off
color 84
cls
echo "This is a dead end"
pause
goto h
:h
echo off
color 84
cls
echo You go right and hug the left wall and now there are two hallways to your right. You cant see down either of them.
echo.
echo -first
echo -second
set /p MOVE22=where would you like to go?
if %MOVE22%== first goto I1
if %MOVE22%== second goto i
:I1
echo off
color 84
cls
echo "this is a dead end"
pause
goto h
:i
echo off
color 89
cls
echo You go to the second hallway and hang a left at the end of the hall. Now you can go left or right, again.
echo.
echo -left
echo -right
set /p MOVE23=where would you like to go?
if %MOVE23%== left goto deathC
if %MOVE23%== right goto j
:deathC
echo off
color 84
cls
echo You go into a room with a chest at the back wall. Maybe it has a map in it...
echo.
echo -open
echo -back
set /p MOVE24=what would you like to do?
if %MOVE24%== open goto deadC
if %MOVE24%== back goto i
:deadC
echo off
color 84
cls
echo You open it slowly, it creaks with an eerie noise. As you peer into the dark box when suddenly... *woooshhhh*
echo A swarm of flying SPIDERS rushes at your face! You scream and try to swat them off your face as they crawl into
echo your skull through your eye sockets. Devouring your eyes as the move toward your brain... and the worst part...
ping 123.45.67.89 -n 1 -w 20000 >nul
cls
echo You can feel.
ping 123.45.67.89 -n 1 -w 3000 >nul
cls
echo Every.
ping 123.45.67.89 -n 1 -w 2500 >nul
cls
echo Bite.
ping 123.45.67.89 -n 1 -w 2000 >nul
goto game over
:j
echo off
color 89
cls
echo You go right and come to a rather large room-like area. To your right is just another dead end. Hopefully going left will
echo not get you killed.
pause
cls
echo You go left until you reach a right turn, but you are not at the end of the hallway yet.
echo.
echo -continue
echo -right
set /p MOVE25=what would you like to do?
if %MOVE25%== continue goto deathD
if %MOVE25%== right goto k
:deathD
echo off
color 84
cls
echo You continue down the long tunnel and as you go farther, you see a light at the end.
ping 123.45.67.89 -n 1 -w 5000 >nul
color 70
cls
echo "Could this be the way out?"
ping 123.45.67.89 -n 1 -w 5000 >nul
cls
echo "Have I escaped?..."
ping 123.45.67.89 -n 1 -w 3000 >nul
color 74
cls
echo As you get closer to the light, you realize it just coming from another room.
ping 123.45.67.89 -n 1 -w 5000 >nul
color F4
cls
echo The light gets brighter as you approach the doorway.
ping 123.45.67.89 -n 1 -w 5000 >nul
color FC
cls
echo You extend your hand towards the doorknob, the light from withing blinding you through the cracks.
echo You twist slowly, creaking the door open and brace yourself for freedom...
ping 123.45.67.89 -n 1 -w 10000 >nul
color 08
cls
echo.
echo.
echo.
echo.
echo.
echo.
ping 123.45.67.89 -n 1 -w 3000 >nul
color 08
cls
echo You open the door, only to find darkness. Your heart sinks.
echo You turn around to leave and possibly find your way out of this hell-hole,
echo only there's no where to go... *BAM*
ping 123.45.67.89 -n 1 -w 15000 >nul
goto game over
:k
echo off
color 89
cls
echo You go right down the hallway. At the end of a very very long and dark hallway,
echo you can go left or right. Yet again.
echo.
echo -left
echo -right
set /p MOVE26=where would you like to go?
if %MOVE26%== left goto finish
if %MOVE26%== right goto l
:l
echo off
color 84
cls
echo "this is a dead end"
pause
goto :k
:finish
echo off
color 79
cls
echo You make a U turn to your left and go down another long hallway. This time, at the end there is an actual exit.
echo You go to the only way out. It leads to yet another catacomb thats you proceede to crawl through.
pause
call PART2.bat
:game over
echo off
color 4
cls
echo GAME OVER
echo.
echo you died at: %TIME%
echo on: %DATE%
echo.
echo.
pause
call ^\ESCAPE\GAMEDATA\ESCAPE.bat

123
ESCAPE/GAMEDATA/PART2.bat Normal file
View File

@ -0,0 +1,123 @@
echo off
color 89
cls
echo You crawl through the dark catacombs. Just as your eyes adjust to the dark and you can start to see, a blinding light coming from the end.
echo You crawl into the light. When you finaly reach the end, you realize you're in a powder room. There is a girl in the corner sitting at a vanity.
echo.
echo -talk
echo -leave
set /p MOVE1=What would you like to do?
if %MOVE1%== talk goto 1
if %MOVE1%== leave goto a
:a
echo off
color 84
cls
echo You turn around to leave when you see that the hole that you just came through is gone. You look back at the girl and shes
echo stares at you with a death glare. *BAM*
pause
goto game over
:1
echo off
color 80
cls
echo "Who are you?" you say
ping 123.45.67.89 -n 1 -w 4000 >nul
echo off
color 8B
cls
echo "My name is Macy." says the girl quietly in a soft voice
ping 123.45.67.89 -n 1 -w 7000 >nul
echo off
color 89
cls
:INV1
cls
echo 1=where am I?
echo 2=what are you doing here?
echo 3=who am I?
echo.
echo Type the NUMBER of your choice
set /p MOVE2=What would you like to say?
if %MOVE2%== 1 goto 2
if %MOVE2%== 2 goto 3
if %MOVE2%== 3 goto B
if not %MOVE2%== 1 echo invalid input
ping 123.45.67.89 -n 1 -w 2000 >nul
goto INV1
:B
echo off
color 8B
cls
echo "That is unimportant now."
pause
goto INV1
:2
echo off
color 8B
cls
echo "You are in my vanity room."
pause
goto INV1
:3
echo off
color 8B
cls
echo "I'm waiting for my reflecion to show again..."
ping 123.45.67.89 -n 1 -w 3000 >nul
:INV2
echo off
color 89
cls
echo "I'm waiting for my reflecion to show again..."
echo.
echo -reflection?
echo -cool...
set /p MOVE3=What do you say?
if %MOVE3%== reflection? goto 4
if %MOVE3%== cool... goto C
if not %MOVE3%== reflection echo Invalid input
ping 123.45.67.89 -n 1 -w 2000 >nul
cls
goto INV2
:C
echo off
color 8B
cls
echo "It was all I had... and now it's gone. I'll never know what I look like again..."
ping 123.45.67.89 -n 1 -w 4000 >nul
goto INV3
:4
echo off
color 8B
cls
echo "Yes, my reflection. It use to show, but now it's gone... It was all i had left."
ping 123.45.67.89 -n 1 -w 5000 >nul
:INV3
echo off
color 89
cls
echo
echo
set /p %MOVE4%=What would you like to say?
if not %MOVE4%== goto INV3
:game over
echo off
color 4
cls
echo GAME OVER
echo.
echo you died at: %TIME%
echo on: %DATE%
echo.
echo.
pause
call ESCAPE.bat

2
ESCAPE/desktop.ini Normal file
View File

@ -0,0 +1,2 @@
[.ShellClassInfo]
IconResource=E:\CODING\ESCAPE\GAMEDATA\1\2\3\4\5\Icon\Escape.ico,0

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

View File

@ -0,0 +1,316 @@
########################################################################################################################
# programmed by Zachary Hunter
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
########################################################################################################################
import pygame, random, sys, time
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 1024
WINDOWHEIGHT = 600
FPS = 6000
ZOMBIESIZE =40
CRAWLERSIZE = 55
ADDNEWZOMBIERATE = 30
ADDNEWCRAWLERRATE = ADDNEWZOMBIERATE
NORMALZOMBIESPEED = 10
CRAWLERZOMBIESPEED = NORMALZOMBIESPEED / 2
PLAYERMOVERATE = 20
BULLETSPEED = 50
ADDNEWBULLETRATE = 10
highScore = 0
TEXTCOLOR = (255, 255, 255)
RED = (255, 0, 0)
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def playerHasHitZombie(playerRect, zombies):
for z in zombies:
if playerRect.colliderect(z['rect']):
return True
return False
def bulletHasHitZombie(bullets, zombies):
for b in bullets:
if b['bulletRect'].colliderect(z['rect']):
return True
return False
def bulletHasHitCrawler(bullets, crawlers):
for b in bullets:
if b['bulletRect'].colliderect(c['rect']):
return True
return False
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def showScore():
drawText('creepers gotten past: %s' % (zombiesGottenPast), font, windowSurface, 10, 0)
drawText('score: %s' % (score), font, windowSurface, 10, 30)
def closeHighScoreTextFile():
#highScoreText.flush
highScoreText.close
# set up pygame, the window, and the mouse cursor
pygame.init()
mainClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), pygame.FULLSCREEN)
pygame.display.set_caption('Creeper Defence')
pygame.mouse.set_visible(False)
# set up fonts
font = pygame.font.SysFont(None, 48)
# set up sounds
gameOverSound = pygame.mixer.Sound('gameover.mp3')
pygame.mixer.music.load('aether2.ogg')
# set up images
playerImage = pygame.image.load('player.png')
playerRect = playerImage.get_rect()
bulletImage = pygame.image.load('bullet.png')
bulletRect = bulletImage.get_rect()
zombieImage = pygame.image.load('Creeper.png')
crawlerImage = pygame.image.load('crawler.png')
backgroundImage = pygame.image.load('background.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
# show the "Start" screen
windowSurface.blit(rescaledBackground, (0, 0))
pygame.draw.line(windowSurface, RED, (WINDOWWIDTH / 2 + 20, WINDOWHEIGHT - 50), (WINDOWWIDTH / 2 + 20, 0), 1)
windowSurface.blit(playerImage, (WINDOWWIDTH / 2, WINDOWHEIGHT - 50))
drawText('Creeper Defence', font, windowSurface, (WINDOWWIDTH / 2) - 105, (WINDOWHEIGHT / 3))
drawText('Press Enter to start', font, windowSurface, (WINDOWWIDTH / 2) - 135, (WINDOWHEIGHT / 3) + 50)
pygame.display.update()
waitForPlayerToPressKey()
while True:
# set up the start of the game
zombies = []
crawlers = []
bullets = []
zombiesGottenPast = 0
score = 0
playerRect.topleft = (WINDOWWIDTH / 2, WINDOWHEIGHT - 50)
moveLeft = moveRight = False
shoot = False
zombieAddCounter = 0
crawlerAddCounter = 0
bulletAddCounter = 40
pygame.mixer.music.play(-1, 0.0)
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_SPACE:
shoot = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_SPACE:
shoot = False
# Add new zombies at the top of the screen, if needed.
zombieAddCounter += 1
if zombieAddCounter == ADDNEWCRAWLERRATE:
zombieAddCounter = 0
zombieSize = ZOMBIESIZE
newZombie = {'rect': pygame.Rect(random.randint(0, WINDOWWIDTH-zombieSize), 0 - zombieSize, zombieSize, zombieSize),
'surface':pygame.transform.scale(zombieImage, (zombieSize, zombieSize)),
}
zombies.append(newZombie)
# Add new crawlers at the top of the screen, if needed.
crawlerAddCounter += 1
if crawlerAddCounter == ADDNEWZOMBIERATE:
crawlerAddCounter = 0
crawlerSize = CRAWLERSIZE
newCrawler = {'rect': pygame.Rect(random.randint(0, WINDOWWIDTH-crawlerSize), 0 - crawlerSize, crawlerSize, crawlerSize),
'surface':pygame.transform.scale(crawlerImage, (crawlerSize, crawlerSize * 2)),
}
crawlers.append(newCrawler)
# add new bullet
bulletAddCounter += 1
if bulletAddCounter >= ADDNEWBULLETRATE and shoot == True:
bulletAddCounter = 100000
bulletSize = (15, 5)
newBullet = {'bulletRect': windowSurface.blit(bulletImage, (playerRect.centerx - 2,playerRect.centery))}
bullets.append(newBullet)
# Move the player around.
if moveLeft and playerRect.left > 0:
playerRect.move_ip(-1 * PLAYERMOVERATE, 0)
if moveRight and playerRect.right < WINDOWWIDTH:
playerRect.move_ip(PLAYERMOVERATE, 0)
# Move the zombies down.
for z in zombies:
z['rect'].move_ip(0, NORMALZOMBIESPEED)
# Move the crawlers down.
for c in crawlers:
c['rect'].move_ip(0, CRAWLERZOMBIESPEED)
# move the bullet
for b in bullets:
b['bulletRect'].move_ip(0, -1 * BULLETSPEED)
# Delete zombies that have fallen past the bottom.
for z in zombies[:]:
if z['rect'].top > WINDOWHEIGHT:
zombies.remove(z)
zombiesGottenPast += 1
# Delete crawlers that have fallen past the bottom.
for c in crawlers[:]:
if c['rect'].top > WINDOWHEIGHT:
crawlers.remove(c)
zombiesGottenPast += 1
# check if the bullet has hit the zombie
for z in zombies:
if bulletHasHitZombie(bullets, zombies):
score += 1
zombies.remove(z)
bullets.remove(b)
for c in crawlers:
if bulletHasHitCrawler(bullets, crawlers):
score += 1
crawlers.remove(c)
bullets.remove(b)
# delete bullets going past the top
for b in bullets[:]:
if b['bulletRect'].top < 0:
bullets.remove(b)
# Draw the game world on the window.
windowSurface.blit(rescaledBackground, (0, 0))
# Draw the player's rectangle, rails
pygame.draw.line(windowSurface, RED, (playerRect.centerx - 1, playerRect.centery - 20), (playerRect.centerx - 1, 0), 1)
windowSurface.blit(playerImage, playerRect)
# Draw each baddie
for z in zombies:
windowSurface.blit(z['surface'], z['rect'])
for c in crawlers:
windowSurface.blit(c['surface'], c['rect'])
# draw each bullet
for b in bullets:
windowSurface.blit(bulletImage, b['bulletRect'])
# Draw the score and how many zombies got past
showScore()
# update the display
pygame.display.update()
# Check if any of the zombies has hit the player.
if playerHasHitZombie(playerRect, zombies):
break
if playerHasHitZombie(playerRect, crawlers):
break
# check if score is over 5 which means game over
if zombiesGottenPast >= 5:
break
mainClock.tick(FPS)
# Stop the game and show the "Game Over" screen.
pygame.mixer.music.stop()
gameOverSound.play()
time.sleep(0.1)
if zombiesGottenPast >= 5:
windowSurface.blit(rescaledBackground, (0, 0))
pygame.draw.line(windowSurface, RED, (WINDOWWIDTH / 2 + 20, WINDOWHEIGHT - 50), (WINDOWWIDTH / 2 + 20, 0), 1)
windowSurface.blit(playerImage, (WINDOWWIDTH / 2, WINDOWHEIGHT - 50))
showScore()
drawText('GAME OVER', font, windowSurface, (WINDOWWIDTH / 2) - 85, (WINDOWHEIGHT / 3))
drawText('you let to many zombies get past', font, windowSurface, (WINDOWWIDTH / 2)- 115, (WINDOWHEIGHT / 3) + 100)
drawText('Press enter to play again or escape to exit', font, windowSurface, (WINDOWWIDTH / 3) - 215, (WINDOWHEIGHT / 3) + 150)
pygame.display.update()
waitForPlayerToPressKey()
if playerHasHitZombie(playerRect, zombies):
windowSurface.blit(rescaledBackground, (0, 0))
pygame.draw.line(windowSurface, RED, (WINDOWWIDTH / 2 + 20, WINDOWHEIGHT - 50), (WINDOWWIDTH / 2 + 20, 0), 1)
windowSurface.blit(playerImage, (WINDOWWIDTH / 2, WINDOWHEIGHT - 50))
showScore()
drawText('GAME OVER!', font, windowSurface, (WINDOWWIDTH / 2) - 85, (WINDOWHEIGHT / 3))
drawText('a zombie has hit you!', font, windowSurface, (WINDOWWIDTH / 2.1) - 115, (WINDOWHEIGHT / 3) +100)
drawText('Press enter to play again or escape to exit.', font, windowSurface, (WINDOWWIDTH / 2.5) - 215, (WINDOWHEIGHT / 3) + 150)
pygame.display.update()
waitForPlayerToPressKey()
gameOverSound.stop()

View File

@ -0,0 +1,8 @@
The object of the game is to kill all the creepers.
movement is a and d and space to shoot
You have taken control of a USA super railroad cannon! And the creepers(Terrorists)
have begun there invasion on ocean city, MD. Your job is to stop this incoming
attack! This will be one hell of a job because it seems like they'll never stop
coming.....
just open creeperdefense.py

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

View File

@ -0,0 +1,443 @@
import pygame, random, sys, time, pygame._view
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 1024
WINDOWHEIGHT = 640
FPS = 6000
TEXTCOLOR = (140, 0, 0)
BLACK = (0,0,0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
DARKRED = (136, 0, 0)
GREY = (100, 100, 100)
# set up pygame, the window, and the mouse cursor
pygame.init()
mainClock = pygame.time.Clock()
Window = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
WindowSurf = pygame.Surface((WINDOWWIDTH, WINDOWHEIGHT))
Rect = WindowSurf.get_rect()
winrect=Window.get_rect()
backgroundSurface = pygame.Surface
pygame.display.set_caption('ESCAPE')
# set up fonts
font = pygame.font.Font(None, 30)
font2 = pygame.font.Font(None, 250)
font3 = pygame.font.Font(None, 175)
#Images
#key
KeyImage = pygame.image.load('TexturePack/Key.png')
#area1
#scissors
scissorsImage = pygame.image.load('TexturePack/area1/scissors.png')
scissorsRect = scissorsImage.get_rect()
#startroom
backgroundImage = pygame.image.load('TexturePack/area1/Background1.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Title
titleImage = pygame.image.load('TexturePack/area1/title.png').convert_alpha()
rescaledTitle = pygame.transform.scale(titleImage, (WINDOWWIDTH, WINDOWHEIGHT))
#start room lit
startRoomLitImage = pygame.image.load('TexturePack/area1/Background1lit.png')
rescaledstartRoomLit = pygame.transform.scale(startRoomLitImage, (WINDOWWIDTH, WINDOWHEIGHT))
#images, area2
#Background
A2Background = pygame.image.load('Texturepack/area2/Background2.png')
rescaledA2Background = pygame.transform.scale(A2Background, (WINDOWWIDTH, WINDOWHEIGHT))
#Save
SaveImage = pygame.image.load('TexturePack/save.png')
SaveRect = SaveImage.get_rect()
PlayerHitTl = False
PlayerHitTr = False
PlayerHitBl = False
PlayerHitBr = False
def terminate():
pygame.quit()
sys.exit()
def textBox(Word, x, y):
Text = font.render(Word, True, BLACK)
rect = Text.get_rect()
textBox1 = pygame.Surface((200, 50))
textBox2 = pygame.Surface((200, 50))
rect1 = textBox1.get_rect()
texts['title']=[textBox1, rect]
textBox1.fill(DARKRED)
textBox2.fill(RED)
pygame.draw.rect(textBox1, GREY, rect1, 5)
pygame.draw.rect(textBox2, GREY, rect1, 5)
rect.center = rect1.center
textBox1.blit(Text, rect)
textBox2.blit(Text, rect)
rect1.centerx= x
rect1.top=texts['title'][1].top+ y
texts[Word]=[textBox1, rect1, textBox2]
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
if texts[Word][1].collidepoint(event.pos):
mode = Word
mouse=pygame.mouse.get_pos()
if texts[Word][1].collidepoint(mouse):
Window.blit(texts[Word][2], texts[Word][1])
else:
Window.blit(texts[Word][0], texts[Word][1])
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def collideTl(x1, y1, w1, h1, x2, y2, w2, h2):
#top left
if (x2+w2>=x1>=x2 and y2+h2>=y1+5>=y2):
return True
else:
return False
def collideTr(x1, y1, w1, h1, x2, y2, w2, h2):
#top right
if (x2+w2>=x1+w1>=x2 and y2+h2>=y1+5>=y2):
return True
else:
return False
def collideBl(x1, y1, w1, h1, x2, y2, w2, h2):
#bottom left
if (x2+w2>=x1>=x2 and y2+h2>=y1+h1+5>=y2):
return True
else:
return False
def collideBr(x1, y1, w1, h1, x2, y2, w2, h2):
#bottom right
if (x2+w2>=x1>=x2 and y2+h2>=y1+h1+5>=y2):
return True
else:
return False
class Wall():
def __init__(self,x,y,w,h):
self.x=x
self.y=y
self.width=w
self.height=h
def render(self, tL, tR, bL, bR):
if (tL==True):
None
if (tR==True):
None
if (bL==True):
None
if (bR==True):
None
else:
pygame.draw.rect(Window,BLACK,(self.x,self.y,self.width,self.height))
class solidWall():
def __init__(self,x,y,w,h):
self.x=x
self.y=y
self.width=w
self.height=h
def render(self, tL, tR, bL, bR):
if (tL==True):
global PlayerHitTl
PlayerHitTl = True
None
if (tR==True):
global PlayerHitTr
PlayerHitTr = True
None
if (bL==True):
global PlayerHitBl
PlayerHitBl = True
None
if (bR==True):
global PlayerHitBr
PlayerHitBr = True
None
if (tL==False):
global PlayerHitTl
PlayerHitTl = False
if (tR==False):
global PlayerHitTr
PlayerHitTr = False
if (bL==False):
global PlayerHitBl
PlayerHitBl = False
if (bR==False):
global PlayerHitBr
PlayerHitBr = False
pygame.draw.rect(Window,RED,(self.x,self.y,self.width,self.height))
class Sprite:
def __init__(self,x,y):
#demensions
self.x=x
self.y=y
self.width=30
self.height=30
self.reset = False
#images
self.i0 = pygame.image.load('TexturePack/Player/Player.png')
self.i1 = pygame.image.load('TexturePack/Player/Player1.png')
self.i2 = pygame.image.load('TexturePack/Player/Player2.png')
#image Rotation
self.i0L=pygame.transform.rotate(self.i0,90)
self.i0R=pygame.transform.rotate(self.i0,270)
self.i0U=pygame.transform.rotate(self.i0, 0)
self.i0D=pygame.transform.rotate(self.i0, 180)
#Rect
self.rect = self.i0.get_rect
#frame update
self.timeTarget=10
self.timeNum=0
self.currentImage=0
self.face = 0
def render(self):
if (self.currentImage==0):
if moveLeft == True:
self.face=1
if moveRight == True:
self.face=2
if moveUp == True:
self.face=0
if moveDown == True:
self.face=3
if self.face == 1:
Window.blit(self.i0L, (self.x, self.y))
if self.face == 2:
Window.blit(self.i0R, (self.x, self.y))
if self.face == 0:
Window.blit(self.i0U, (self.x, self.y))
if self.face == 3:
Window.blit(self.i0D, (self.x, self.y))
if self.reset == 1:
self.x = 500
self.y = 570
self.reset = 2
pygame.display.flip()
def TitleScreen():
Window.blit(rescaledTitle, (0, 0))
pygame.display.update()
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.type == pygame.MOUSEBUTTONDOWN:
if texts['Exit'][1].collidepoint(event.pos):
terminate()
if texts['Start'][1].collidepoint(event.pos):
global mode
mode = 'A1'
def area1():
# Draw the game world on the window.
# set up start of game
Window.fill(BLACK)
Window.blit(rescaledBackground, (0,0))
# set up rooms
#start room
Startroom=Wall(310,430, 310, 225)
tL=collideTl(Player.x,Player.y,Player.width-15,Player.height-15,Startroom.x,Startroom.y,Startroom.width,Startroom.height)
tR=collideTr(Player.x,Player.y,Player.width-15,Player.height-15,Startroom.x,Startroom.y,Startroom.width,Startroom.height)
bL=collideBl(Player.x,Player.y,Player.width-15,Player.height-15,Startroom.x,Startroom.y,Startroom.width,Startroom.height)
bR=collideBr(Player.x,Player.y,Player.width-15,Player.height-15,Startroom.x,Startroom.y,Startroom.width,Startroom.height)
Startroom.render(tL, tR, bL, bR)
#hallway1
Hall=Wall(172,320, 701, 110)
tL=collideTl(Player.x,Player.y,Player.width-15,Player.height-15,Hall.x,Hall.y,Hall.width,Hall.height)
tR=collideTr(Player.x,Player.y,Player.width-15,Player.height-15,Hall.x,Hall.y,Hall.width,Hall.height)
bL=collideBl(Player.x,Player.y,Player.width-15,Player.height-15,Hall.x,Hall.y,Hall.width,Hall.height)
bR=collideBr(Player.x,Player.y,Player.width-15,Player.height-15,Hall.x,Hall.y,Hall.width,Hall.height)
Hall.render(tL, tR, bL, bR)
#torture room
tRoom=Wall(324,0, 700, 320)
tL=collideTl(Player.x,Player.y,Player.width-15,Player.height-15,tRoom.x,tRoom.y,tRoom.width,tRoom.height)
tR=collideTr(Player.x,Player.y,Player.width-15,Player.height-15,tRoom.x,tRoom.y,tRoom.width,tRoom.height)
bL=collideBl(Player.x,Player.y,Player.width-15,Player.height-15,tRoom.x,tRoom.y,tRoom.width,tRoom.height)
bR=collideBr(Player.x,Player.y,Player.width-15,Player.height-15,tRoom.x,tRoom.y,tRoom.width,tRoom.height)
tRoom.render(tL, tR, bL, bR)
#stairs
stairs=solidWall(873,320,157,115)
tL=collideTl(Player.x,Player.y,Player.width-15,Player.height-15,stairs.x,stairs.y,stairs.width,stairs.height)
tR=collideTr(Player.x,Player.y,Player.width-15,Player.height-15,stairs.x,stairs.y,stairs.width,stairs.height)
bL=collideBl(Player.x,Player.y,Player.width-15,Player.height-15,stairs.x,stairs.y,stairs.width,stairs.height)
bR=collideBr(Player.x,Player.y,Player.width-15,Player.height-15,stairs.x,stairs.y,stairs.width,stairs.height)
stairs.render(tL, tR, bL, bR)
#hallway 2
Hall2 = Wall(170,0,151,320)
tL=collideTl(Player.x,Player.y,Player.width-15,Player.height-15,Hall2.x,Hall2.y,Hall2.width,Hall2.height)
tR=collideTr(Player.x,Player.y,Player.width-15,Player.height-15,Hall2.x,Hall2.y,Hall2.width,Hall2.height)
bL=collideBl(Player.x,Player.y,Player.width-15,Player.height-15,Hall2.x,Hall2.y,Hall2.width,Hall2.height)
bR=collideBr(Player.x,Player.y,Player.width-15,Player.height-15,Hall2.x,Hall2.y,Hall2.width,Hall2.height)
Hall2.render(tL, tR, bL, bR)
Player.render()
def area2():
Hall2 = False
Hall3 = False
Bathroom = False
SaveRoom1 = False
Player.reset += 1
Window.fill(BLACK)
Window.blit(rescaledA2Background, (0,0))
SaveRoom1 = Wall(170,220,0,320)
collisions=collide(Player.x,Player.y,Player.width-15,Player.height-15,SaveRoom1.x,SaveRoom1.y,SaveRoom1.width,SaveRoom1.height)
SaveRoom1.render(collisions)
Player.render()
# show the "Start" screen
Player = Sprite(500,570)
wall = Wall(0,0,100,100)
TitleScreen()
waitForPlayerToPressKey()
texts={}
PlayerHit = False
while True:
mode = 'A1'
moveLeft = moveRight =False
moveUp = moveDown = False
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
if (collideTl==False):
global PlayerHitTl
PlayerHitTl = False
if (collideTr==False):
global PlayerHitTr
PlayerHitTr = False
if (collideBl==False):
global PlayerHitBl
PlayerHitBl = False
if (collideBr==False):
global PlayerHitBr
PlayerHitBr = False
# Move the player around.
if moveLeft == True and Player.x > 0 and PlayerHitTl == False and PlayerHitBl == False:
Player.x += -2
if moveRight == True and Player.x < WINDOWWIDTH-30 and PlayerHitTr == False and PlayerHitBr == False:
Player.x += 2
if moveUp == True and Player.y > 0 and PlayerHitTl == False and PlayerHitTr == False:
Player.y += -2
if moveDown == True and Player.y < WINDOWHEIGHT-30 and PlayerHitBl == False and PlayerHitBr == False:
Player.y += 2
if Player.y <=30:
global mode
mode = 'A2'
pygame.time.delay(10)
global mode
if mode == 'title':
TitleScreen()
elif mode == 'A1':
area1()
elif mode == 'A2':
area2()
# update the display
mainClock.tick(60)

View File

@ -0,0 +1,308 @@
import pygame, random, sys, time
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 1024
WINDOWHEIGHT = 600
FPS = 6000
TEXTCOLOR = (140, 0, 0)
BLACK = (0,0,0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
Area1 = False
Area2 = False
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
class Sprite:
def __init__(self,x,y):
#demensions
self.x=x
self.y=y
self.width=30
self.height=30
self.reset = False
#images
self.i0 = pygame.image.load('TexturePack/Player/Player.png')
self.i1 = pygame.image.load('TexturePack/Player/Player1.png')
self.i2 = pygame.image.load('TexturePack/Player/Player2.png')
#image Rotation
self.i0L=pygame.transform.rotate(self.i0,90)
self.i0R=pygame.transform.rotate(self.i0,270)
self.i0U=pygame.transform.rotate(self.i0, 0)
self.i0D=pygame.transform.rotate(self.i0, 180)
#frame update
self.timeTarget=10
self.timeNum=0
self.currentImage=0
self.face = 0
def render(self):
if (self.currentImage==0):
if moveLeft == True:
self.face=1
if moveRight == True:
self.face=2
if moveUp == True:
self.face=0
if moveDown == True:
self.face=3
if self.face == 1:
windowSurface.blit(self.i0L, (self.x, self.y))
if self.face == 2:
windowSurface.blit(self.i0R, (self.x, self.y))
if self.face == 0:
windowSurface.blit(self.i0U, (self.x, self.y))
if self.face == 3:
windowSurface.blit(self.i0D, (self.x, self.y))
if self.reset == True:
self.x = 500
self.y = 570
self.reset = False
pygame.display.flip()
def area1():
# Draw the game world on the window.
# set up start of game
startRoom = False
Lit = False
Hall=False
HallWay = False
tortureRoom= False
windowSurface.fill(BLACK)
if Player.y < 368 and Player.y > 270:
Hall = True
startRoom = False
tortureRoom = False
HallWay = False
if Player.y < 270 and Player.x > 319:
tortureRoom = True
Hall = False
startRoom = False
HallWay = False
if Player.y > 368:
startRoom = True
Hall = False
tortureRoom = False
HallWay = False
if Player.x < 319 and Player.y < 300:
tortureRoom = False
HallWay = True
Hall = False
startRoom = False
if startRoom==True:
Hall= False
tortureRoom=False
windowSurface.blit(rescaledBackground, (0, 0))
windowSurface.blit(scissorsImage, (500,410))
if HallWay == True:
windowSurface.blit(hallImage2, (0,0))
if Lit == True:
windowSurface.blit(rescaledstartRoomLit,(0,0))
windowSurface.blit(scissorsImage, (505,414))
if tortureRoom == True:
windowSurface.blit(rescaledTortureRoom, (0,0))
if Hall == True:
windowSurface.blit(rescaledHall, (0,0))
Player.render()
def area2():
Hall2 = False
Hall3 = False
Bathroom = False
SaveRoom1 = False
Player.reset = True
windowSurface.fill(BLACK)
if Player.x > 650:
Bathroom = True
if Player.x < 435:
SaveRooom1 = True
if Player.y < (WINDOWHEIGHT -10) and Player.x > 435 and Player.x < 650:
Hall3 = True
if Bathroom == True:
windowSurface.blit(rescaledBathroom, (0,0))
if SaveRoom1 == True:
windowSurface.blit(SaveRoom1Image, (0,0))
if Hall3 == True:
windowSurface.blit(rescaledHall3, (0,0))
Player.render()
# set up pygame, the window, and the mouse cursor
pygame.init()
mainClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), pygame.FULLSCREEN)
backgroundSurface = pygame.Surface
pygame.display.set_caption('ESCAPE')
pygame.mouse.set_visible(True)
# set up fonts
font = pygame.font.SysFont(None, 48)
#Images
#area1
#scissors
scissorsImage = pygame.image.load('TexturePack/area1/scissors.png')
scissorsRect = scissorsImage.get_rect()
#startroom
backgroundImage = pygame.image.load('TexturePack/area1/background1.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Title
titleImage = pygame.image.load('TexturePack/area1/title.png').convert_alpha()
rescaledTitle = pygame.transform.scale(titleImage, (WINDOWWIDTH, WINDOWHEIGHT))
#start room lit
startRoomLitImage = pygame.image.load('TexturePack/area1/Background1lit.png')
rescaledstartRoomLit = pygame.transform.scale(startRoomLitImage, (WINDOWWIDTH, WINDOWHEIGHT))
#toture room
tortureRoomImage=pygame.image.load('TexturePack/area1/Background1-tortureRoom.png')
tortureRoomRect = tortureRoomImage.get_rect
rescaledTortureRoom = pygame.transform.scale(tortureRoomImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall
hallImage = pygame.image.load('TexturePack/area1/Background1-Hall.png')
rescaledHall = pygame.transform.scale(hallImage, (WINDOWWIDTH, WINDOWHEIGHT))
#HallWay
hallImage2 = pygame.image.load('TexturePack/area1/Background1-Hall2.png')
rescaledHallWay = pygame.transform.scale(hallImage, (WINDOWWIDTH ,WINDOWHEIGHT))
#images, area2
#bathroom
BathroomImage = pygame.image.load('TexturePack/area2/Bathroom.png')
rescaledBathroom = pygame.transform.scale(BathroomImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall2
Hall2Image = pygame.image.load('TexturePack/area2/Hall2.png')
rescaledHall2 = pygame.transform.scale(Hall2Image, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall3
Hall3Image = pygame.image.load('TexturePack/area2/Hall3.png')
rescaledHall3 = pygame.transform.scale(Hall3Image, (WINDOWWIDTH, WINDOWHEIGHT))
#SaveRoom1
SaveRoom1Image = pygame.image.load('TexturePack/area2/SaveRoom1.png')
rescaledSaveRoom1 = pygame.transform.scale(SaveRoom1Image, (WINDOWWIDTH,WINDOWHEIGHT))
# show the "Start" screen
windowSurface.blit(rescaledTitle, (0, 0))
drawText('Press Enter to start', font, windowSurface, (WINDOWWIDTH / 2) - 180, (WINDOWHEIGHT / 3) + 125)
pygame.display.update()
waitForPlayerToPressKey()
Area1 = True
Area2 = False
Player = Sprite(500,570)
PlayerA1y = Player.y
while True:
moveLeft = moveRight =False
moveUp = moveDown = False
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
# Move the player around.
if moveLeft and Player.x > 0:
Player.x += -5
if moveRight and Player.x < WINDOWWIDTH-30:
Player.x += 5
if moveUp and Player.y > 0:
Player.y += -5
if moveDown and Player.y < WINDOWHEIGHT-30:
Player.y += 5
# update the display
mainClock.tick(60)
if Player.y <30:
Area1 = False
Area2 = True
pygame.time.delay(10)
if Area1 == True:
area1()
if Area2 == True:
area2()

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -0,0 +1,141 @@
import pygame, random, sys, time
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 600
WINDOWHEIGHT = 400
window = pygame.display.set_mode((600,400))
TEXTCOLOR = (255, 0, 0)
BLACK = (0,0,0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
playerImage = pygame.image.load('Player.png')
playerRect = playerImage.get_rect()
moveX,moveY=0,0
mainClock = pygame.time.Clock()
class Sprite:
def __init__(self,x,y):
self.x=x
self.y=y
self.image=playerImage
self.rect=playerRect
surface=pygame.get_rect()
def render(self):
pygame.draw.rect(window,white,(self.x,self.y,self.width,self.height))
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
player = Sprite
# set up pygame, the window, and the mouse cursor
pygame.init()
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
pygame.display.set_caption('ESCAPE')
pygame.mouse.set_visible(True)
# set up fonts
font = pygame.font.SysFont(None, 48)
# set up images
backgroundImage = pygame.image.load('background1.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
# show the "Start" screen
windowSurface.blit(rescaledBackground, (0, 0))
drawText(' Welcome to ESCAPE', font, windowSurface, (WINDOWWIDTH / 2) - 105, (WINDOWHEIGHT / 3))
drawText('Press Enter to start', font, windowSurface, (WINDOWWIDTH / 2) - 135, (WINDOWHEIGHT / 3) + 50)
pygame.display.update()
waitForPlayerToPressKey()
while True:
# set up start of game
moveLeft = moveRight =False
moveUp = moveDown = False
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
moveX=-5
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
moveX=5
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
moveY=-5
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
moveY=5
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
moveX=0
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
moveX=0
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
moveY=0
if event.key == K_UP or event.key == ord('w'):
moveUp = False
moveY=0
# Move the player around.
player.x += moveX
player.y += moveY
# Draw the game world on the window.
windowSurface.blit(rescaledBackground, (0, 0))
# Draw the game world on the window.
windowSurface.blit(rescaledBackground, (0, 0))
# Draw the player's rectangle, rails
windowSurface.blit(playerImage,playerRect, (x,y,50,50))
# update the display
pygame.display.update()
pygame.display.flip()
mainClock.tick(50)

View File

@ -0,0 +1,267 @@
import pygame, random, sys, time
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 1024
WINDOWHEIGHT = 600
FPS = 60
TEXTCOLOR = (140, 0, 0)
BLACK = (0,0,0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
# set up pygame, the window, and the mouse cursor
pygame.init()
mainClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
pygame.display.set_caption('ESCAPE')
pygame.mouse.set_visible(False)
# set up fonts
font = pygame.font.SysFont(None, 48)
# set up images
#player
playerImage = pygame.image.load('Player.png').convert_alpha()
playerRect = playerImage.get_rect()
playerRotateL = pygame.transform.rotate(playerImage,90)
playerRotateR = pygame.transform.rotate(playerImage,270)
playerRotateU = pygame.transform.rotate(playerImage,0)
playerRotateD = pygame.transform.rotate(playerImage,180)
#scissors
scissorsImage = pygame.image.load('scissors.png')
scissorsRect = scissorsImage.get_rect()
#startroom
backgroundImage = pygame.image.load('background1.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
backgroundStart = pygame.Surface((WINDOWWIDTH,WINDOWHEIGHT))
#Title
titleImage = pygame.image.load('title.png').convert_alpha()
rescaledTitle = pygame.transform.scale(titleImage, (WINDOWWIDTH, WINDOWHEIGHT))
Title = pygame.Surface ((WINDOWWIDTH,WINDOWHEIGHT))
#start room lit
startRoomLitImage = pygame.image.load('Background1lit.png')
rescaledstartRoomLit = pygame.transform.scale(startRoomLitImage, (WINDOWWIDTH, WINDOWHEIGHT))
#toture room
tortureRoomImage=pygame.image.load('Background1-tortureRoom.png')
tortureRoomRect = tortureRoomImage.get_rect
rescaledTortureRoom = pygame.transform.scale(tortureRoomImage, (WINDOWWIDTH, WINDOWHEIGHT))
backgroundTor = pygame.Surface ((WINDOWWIDTH,WINDOWHEIGHT))
#Hall
hallImage = pygame.image.load('Background1-Hall.png')
rescaledHall = pygame.transform.scale(hallImage, (WINDOWWIDTH, WINDOWHEIGHT))
backgroundHall = pygame.Surface((WINDOWWIDTH,WINDOWHEIGHT))
#Hall2
hallImage2 = pygame.image.load('Background1-Hall2.png')
rescaledHall2 = pygame.transform.scale(hallImage, (WINDOWWIDTH ,WINDOWHEIGHT))
backgroundHall2 = pygame.Surface((WINDOWWIDTH,WINDOWHEIGHT))
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def Area1():
# update the display
moveLeft = moveRight =()
moveUp = moveDown = ()
startRoom = ()
Lit = ()
Hall=()
Hall2 = ()
tortureRoom= ()
# Draw the player's rectangle, rails
playerRect.centerx - 1, playerRect.centery - 20, (playerRect.centerx - 1, 0), 1
pygame.display.update(playerRect)
pygame.display.flip()
# Draw the game world on the window.
# Hall2
if playerRect.bottom > 300 and playerRect.right < 320:
tortureRoom = False
Hall2 = True
Hall = False
startRoom = False
pygame.display.update(playerRect)
# Hall
if playerRect.bottom < 405 and playerRect.centery > 300:
Hall = True
startRoom = False
tortureRoom = False
Hall2 = False
pygame.display.update(playerRect)
# tortureRoom
if playerRect.bottom < 295 and playerRect.right > 319:
tortureRoom = True
Hall = False
startRoom = False
Hall2 = False
pygame.display.update(playerRect)
#startRoom
if playerRect.bottom > 405:
startRoom = True
Hall = False
tortureRoom = False
Hall2 = False
pygame.display.update(playerRect)
while startRoom==True:
Hall = False
Hall2 = False
tortureRoom = False
break
while Hall==True:
startRoom = False
Hall2 = False
tortureRoom = False
break
while Hall2==True:
Hall = False
startRoom = False
tortureRoom = False
break
while tortureRoom==True:
Hall = False
Hall2 = False
startRoom = False
break
if startRoom==True:
Hall= False
tortureRoom=False
Hall2=False
backgroundStart.blit(rescaledBackground, (0, 0))
backgroundStart.blit(scissorsImage, (500,410))
windowSurface.blit(backgroundStart, (0,0))
if Lit == True:
windowSurface.blit(rescaledstartRoomLit,(0,0))
windowSurface.blit(scissorsImage, (500,410))
if tortureRoom == True:
Hall=False
Hall2=False
startRoom=False
backgroundTor.blit(rescaledTortureRoom, (0,0))
windowSurface.blit(backgroundTor, (0,0))
if Hall == True:
startRoom = False
tortureRoom = False
Hall2 = False
backgroundHall.blit(rescaledHall, (0,0))
windowSurface.blit(backgroundHall, (0,0))
if Hall2 == True:
startRoom=False
tortureRoom=False
Hall=False
backgroundHall2.blit(hallImage2, (0,0))
windowSurface.blit(backgroundHall2, (0,0))
# show the "Start" screen
Title.blit(rescaledTitle, (0, 0))
windowSurface.blit(Title,(0,0))
drawText('Press Enter to start', font, windowSurface, (WINDOWWIDTH / 2) - 180, (WINDOWHEIGHT / 3) + 125)
pygame.display.update()
waitForPlayerToPressKey()
while True:
# set up start of game
playerRect.topleft = (WINDOWWIDTH / 2, WINDOWHEIGHT - 50)
moveLeft = moveRight =False
moveUp = moveDown = False
startRoom = True
Lit = False
Hall=False
Hall2 = False
tortureRoom= False
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
# Move the player around.
if moveLeft and playerRect.left > 0:
playerRect.move_ip(-10, 0)
if moveRight and playerRect.right < WINDOWWIDTH:
playerRect.move_ip(10, 0)
if moveUp and playerRect.bottom > 0:
playerRect.move_ip(0,-10)
if moveDown and playerRect.bottom < WINDOWHEIGHT:
playerRect.move_ip(0, +10)
if moveLeft== True:
windowSurface.blit(playerRotateL,(playerRect.centerx,playerRect.centery))
if moveRight== True:
windowSurface.blit(playerRotateR, (playerRect.centerx,playerRect.centery))
if moveUp== True:
windowSurface.blit(playerRotateU, (playerRect.centerx,playerRect.centery))
if moveDown== True:
windowSurface.blit(playerRotateD, (playerRect.centerx,playerRect.centery))
if not moveLeft == True and moveRight== False and moveDown == False:
windowSurface.blit(playerImage, (playerRect.centerx,playerRect.centery))
Area1()

View File

@ -0,0 +1,238 @@
import pygame, random, sys, time
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 1000
WINDOWHEIGHT = 550
FPS = 6000
TEXTCOLOR = (140, 0, 0)
BLACK = (0,0,0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
class Sprite:
def __init__(self,x,y):
#demensions
self.x=x
self.y=y
self.width=30
self.height=30
#images
self.i0 = pygame.image.load('Player.png')
self.i1 = pygame.image.load('Player1.png')
self.i2 = pygame.image.load('Player2.png')
#image Rotation
self.i0L=pygame.transform.rotate(self.i0,90)
self.i0R=pygame.transform.rotate(self.i0,270)
self.i0U=pygame.transform.rotate(self.i0, 0)
self.i0D=pygame.transform.rotate(self.i0, 180)
#frame update
self.timeTarget=10
self.timeNum=0
self.currentImage=0
self.face = 0
def render(self):
if (self.currentImage==0):
if moveLeft == True:
self.face=1
if moveRight == True:
self.face=2
if moveUp == True:
self.face=0
if moveDown == True:
self.face=3
if self.face == 1:
windowSurface.blit(self.i0L, (self.x, self.y))
if self.face == 2:
windowSurface.blit(self.i0R, (self.x, self.y))
if self.face == 0:
windowSurface.blit(self.i0U, (self.x, self.y))
if self.face == 3:
windowSurface.blit(self.i0D, (self.x, self.y))
pygame.display.flip()
# set up pygame, the window, and the mouse cursor
pygame.init()
mainClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
backgroundSurface = pygame.Surface
pygame.display.set_caption('ESCAPE')
pygame.mouse.set_visible(True)
# set up fonts
font = pygame.font.SysFont(None, 48)
#Images
#scissors
scissorsImage = pygame.image.load('scissors.png')
scissorsRect = scissorsImage.get_rect()
#startroom
backgroundImage = pygame.image.load('background1.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Title
titleImage = pygame.image.load('title.png').convert_alpha()
rescaledTitle = pygame.transform.scale(titleImage, (WINDOWWIDTH, WINDOWHEIGHT))
#start room lit
startRoomLitImage = pygame.image.load('Background1lit.png')
rescaledstartRoomLit = pygame.transform.scale(startRoomLitImage, (WINDOWWIDTH, WINDOWHEIGHT))
#toture room
tortureRoomImage=pygame.image.load('Background1-tortureRoom.png')
tortureRoomRect = tortureRoomImage.get_rect
rescaledTortureRoom = pygame.transform.scale(tortureRoomImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall
hallImage = pygame.image.load('Background1-Hall.png')
rescaledHall = pygame.transform.scale(hallImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall2
hallImage2 = pygame.image.load('Background1-Hall2.png')
rescaledHall2 = pygame.transform.scale(hallImage, (WINDOWWIDTH ,WINDOWHEIGHT))
# show the "Start" screen
windowSurface.blit(rescaledTitle, (0, 0))
drawText('Press Enter to start', font, windowSurface, (WINDOWWIDTH / 2) - 180, (WINDOWHEIGHT / 3) + 125)
pygame.display.update()
waitForPlayerToPressKey()
Player = Sprite(500, 500)
while True:
# set up start of game
moveLeft = moveRight =False
moveUp = moveDown = False
startRoom = True
Lit = False
Hall=False
Hall2 = False
tortureRoom= False
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
# Move the player around.
if moveLeft and Player.x > 0:
Player.x += -5
if moveRight and Player.x < WINDOWWIDTH:
Player.x += 5
if moveUp and Player.y > 0:
Player.y += -5
if moveDown and Player.y < WINDOWHEIGHT-22:
Player.y += 5
# Draw the game world on the window.
windowSurface.fill(BLACK)
if Player.y > 300 and Player.x < 350:
tortureRoom = False
Hall2 = True
Hall = False
startRoom = False
if Player.y < 368 and Player.y > 280:
Hall = True
startRoom = False
tortureRoom = False
Hall2 = False
if Player.y < 280 and Player.x > 319:
tortureRoom = True
Hall = False
startRoom = False
Hall2 = False
if Player.y > 368:
startRoom = True
Hall = False
tortureRoom = False
Hall2 = False
if startRoom==True:
Hall= False
tortureRoom=False
windowSurface.blit(rescaledBackground, (0, 0))
windowSurface.blit(scissorsImage, (500,410))
if Lit == True:
windowSurface.blit(rescaledstartRoomLit,(0,0))
windowSurface.blit(scissorsImage, (500,410))
if tortureRoom == True:
windowSurface.blit(rescaledTortureRoom, (0,0))
if Hall == True:
windowSurface.blit(rescaledHall, (0,0))
if Hall2 == True:
windowSurface.blit(hallImage2, (0,0))
# update the display
mainClock.tick(60)
Player.render()
pygame.display.flip()

View File

@ -0,0 +1,216 @@
import pygame, random, sys, time
from pygame.locals import *
#set up some variables
WINDOWWIDTH = 1024
WINDOWHEIGHT = 600
FPS = 6000
TEXTCOLOR = (140, 0, 0)
BLACK = (0,0,0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE: # pressing escape quits
terminate()
if event.key == K_RETURN:
return
if event.key == ord('q'):
return
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
# set up pygame, the window, and the mouse cursor
pygame.init()
mainClock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))
pygame.display.set_caption('ESCAPE')
pygame.mouse.set_visible(False)
# set up fonts
font = pygame.font.SysFont(None, 48)
# set up images
#player
playerImage = pygame.image.load('Player.png').convert_alpha()
playerRect = playerImage.get_rect()
playerRotateL = pygame.transform.rotate(playerImage,90)
playerRotateR = pygame.transform.rotate(playerImage,270)
playerRotateU = pygame.transform.rotate(playerImage,0)
playerRotateD = pygame.transform.rotate(playerImage,180)
#scissors
scissorsImage = pygame.image.load('scissors.png')
scissorsRect = scissorsImage.get_rect()
#startroom
backgroundImage = pygame.image.load('background1.png')
rescaledBackground = pygame.transform.scale(backgroundImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Title
titleImage = pygame.image.load('title.png').convert_alpha()
rescaledTitle = pygame.transform.scale(titleImage, (WINDOWWIDTH, WINDOWHEIGHT))
#start room lit
startRoomLitImage = pygame.image.load('Background1lit.png')
rescaledstartRoomLit = pygame.transform.scale(startRoomLitImage, (WINDOWWIDTH, WINDOWHEIGHT))
#toture room
tortureRoomImage=pygame.image.load('Background1-tortureRoom.png')
tortureRoomRect = tortureRoomImage.get_rect
rescaledTortureRoom = pygame.transform.scale(tortureRoomImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall
hallImage = pygame.image.load('Background1-Hall.png')
rescaledHall = pygame.transform.scale(hallImage, (WINDOWWIDTH, WINDOWHEIGHT))
#Hall2
hallImage2 = pygame.image.load('Background1-Hall2.png')
rescaledHall2 = pygame.transform.scale(hallImage, (WINDOWWIDTH ,WINDOWHEIGHT))
# show the "Start" screen
windowSurface.blit(rescaledTitle, (0, 0))
drawText('Press Enter to start', font, windowSurface, (WINDOWWIDTH / 2) - 180, (WINDOWHEIGHT / 3) + 125)
pygame.display.update()
waitForPlayerToPressKey()
while True:
# set up start of game
playerRect.topleft = (WINDOWWIDTH / 2, WINDOWHEIGHT - 50)
moveLeft = moveRight =False
moveUp = moveDown = False
startRoom = True
Lit = False
Hall=False
Hall2 = False
tortureRoom= False
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
# Move the player around.
if moveLeft and playerRect.left > 0:
playerRect.move_ip(-10, 0)
if moveRight and playerRect.right < WINDOWWIDTH:
playerRect.move_ip(10, 0)
if moveUp and playerRect.bottom > 0:
playerRect.move_ip(0,-10)
if moveDown and playerRect.bottom < WINDOWHEIGHT:
playerRect.move_ip(0, +10)
if moveLeft== True:
windowSurface.blit(playerRotateL,(playerRect.centerx,playerRect.centery))
if moveRight== True:
windowSurface.blit(playerRotateR, (playerRect.centerx,playerRect.centery))
if moveUp== True:
windowSurface.blit(playerRotateU, (playerRect.centerx,playerRect.centery))
if moveDown== True:
windowSurface.blit(playerRotateD, (playerRect.centerx,playerRect.centery))
if not moveLeft == True and moveRight== False and moveDown == False:
windowSurface.blit(playerImage, (playerRect.centerx,playerRect.centery))
# update the display
mainClock.tick(5000)
pygame.display.flip()
# Draw the game world on the window.
if playerRect.bottom > 300 and playerRect.right < 320:
tortureRoom = False
Hall2 = True
Hall = False
startRoom = False
if playerRect.bottom < 405 and playerRect.centery > 295:
Hall = True
startRoom = False
tortureRoom = False
Hall2 = False
if playerRect.bottom < 295 and playerRect.right > 319:
tortureRoom = True
Hall = False
startRoom = False
Hall2 = False
if playerRect.bottom > 405:
startRoom = True
Hall = False
tortureRoom = False
Hall2 = False
if startRoom==True:
Hall= False
tortureRoom=False
windowSurface.blit(rescaledBackground, (0, 0))
windowSurface.blit(scissorsImage, (500,410))
if Lit == True:
windowSurface.blit(rescaledstartRoomLit,(0,0))
windowSurface.blit(scissorsImage, (500,410))
if tortureRoom == True:
windowSurface.blit(rescaledTortureRoom, (0,0))
if Hall == True:
windowSurface.blit(rescaledHall, (0,0))
if Hall2 == True:
windowSurface.blit(hallImage2, (0,0))
# Draw the player's rectangle, rails
playerRect.centerx - 1, playerRect.centery - 20, (playerRect.centerx - 1, 0), 1
pygame.display.update(playerRect)
pygame.display.flip()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

View File

@ -0,0 +1,90 @@
import pygame
pygame.init()
window = pygame.display.set_mode((800,600))
pygame.display.set_caption("Window")
moveX=0
moveY=0
black = (0,0,0)
white = (255, 255, 255)
clock = pygame.time.Clock()
class Sprite():
def __init__(self,x,y):
self.x=x
self.y=y
self.width=50
self.height=50
def render(self):
pygame.draw.rect(window, white, (self.x, self.y, self.width, self.height))
player = Sprite(100,150)
gameLoop=True
while gameLoop:
for event in pygame.event.get():
if (event.type==pygame.QUIT):
gameLoop=False
if (event.type==pygame.KEYDOWN):
if (event.key == pygame.K_LEFT or event.key == ord ('a')):
moveX = -15
if (event.key == pygame.K_RIGHT or event.key == ord ('d')):
moveX = 15
if (event.key == pygame.K_UP or event.key == ord ('w')):
moveY = -15
if (event.key == pygame.K_DOWN or event.key == ord ('s')):
moveY = 15
if (event.type==pygame.KEYUP):
if (event.key == pygame.K_LEFT or event.key == ord ('a')) :
moveX = 0
if (event.key == pygame.K_RIGHT or event.key == ord ('d')):
moveX = 0
if (event.key == pygame.K_UP or event.key == ord ('w')):
moveY = 0
if (event.key == pygame.K_DOWN or event.key == ord ('s')):
moveY = 0
window.fill(black)
player.x += moveX
player.y += moveY
player.render()
clock.tick (500)
pygame.display.flip()
pygame.quit()

View File

@ -0,0 +1,69 @@
import pygame
pygame.init()
window = pygame.display.set_mode((800,600))
pygame.display.set_caption("Window")
black = (0,0,0)
white=(255,255,255)
moveX,moveY=0,0
clock = pygame.time.Clock()
class Sprite:
def __init__(self,x,y):
self.x=x
self.y=y
self.width=50
self.height=50
def render(self):
pygame.draw.rect(window,white,(self.x,self.y,self.width,self.height))
player=Sprite(100,150)
player2=Sprite(200,300)
gameLoop=True
while gameLoop:
for event in pygame.event.get():
if (event.type==pygame.QUIT):
gameLoop=False
if (event.type==pygame.KEYDOWN):
if (event.key==pygame.K_LEFT): moveX = -5
if (event.key==pygame.K_RIGHT): moveX = 5
if (event.key==pygame.K_UP): moveY = -5
if (event.key==pygame.K_DOWN): moveY = 5
if (event.type==pygame.KEYUP):
if (event.key==pygame.K_LEFT): moveX=0
if (event.key==pygame.K_RIGHT): moveX=0
if (event.key==pygame.K_UP): moveY=0
if (event.key==pygame.K_DOWN): moveY=0
window.fill(black)
player.x +=(moveX)
player.y +=(moveY)
player.render()
clock.tick(50)
pygame.display.flip()
pygame.quit()

View File

@ -0,0 +1,22 @@
import pygame
pygame.init()
window = pygame.display.set_mode((600,400))
pygame.display.set_caption("Window")
black = (0,0,0)
gameLoop=True
while gameLoop:
for event in pygame.event.get():
if (event.type==pygame.QUIT):
gameLoop=False
window.fill(black)
pygame.display.flip()
pygame.quit()

View File

@ -0,0 +1,45 @@
import pygame
pygame.init()
window = pygame.display.set_mode((600,400))
pygame.display.set_caption("Animation")
black = (0,0,0)
white = (255, 255, 255)
clock = pygame.time.Clock()
#sprite image load
Sprite1 = pygame.image.load("images/sprite1.png")
Sprite2 = pygame.image.load("images/sprite2.png")
SpriteCurrentImage = 1
gameLoop=True
while gameLoop:
for event in pygame.event.get():
if (event.type==pygame.QUIT):
gameLoop=False
window.fill(white)
if SpriteCurrentImage==1:
window.blit(Sprite1, (10,10))
if SpriteCurrentImage==2:
window.blit(Sprite2, (10,10))
if SpriteCurrentImage==2:
SpriteCurrentImage=1
else:
SpriteCurrentImage+=1;
pygame.display.flip()
clock.tick(10)
pygame.quit()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,166 @@
import pygame, random, sys, time
from pygame.locals import *
windowWidth = 600
windowHeight = 600
FPS = 6000
Green = (0, 255, 0)
Blue = (0, 0, 255)
Red = (255, 0, 0)
Grey = (100, 100, 100)
Black = (0, 0, 0)
White = (255, 255, 255)
moveLeft,moveRight=0,0
moveUp,moveDown=0,0
pygame.init()
Clock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((windowWidth,windowHeight))
pygame.display.set_caption('Rect Race')
pygame.mouse.set_visible(True)
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
terminate()
if event.key == K_RETURN:
return
if event.key == ord ('e'):
return
class Sprite:
def __init__(self,x,y):
#demensions
self.x=x
self.y=y
self.width=50
self.height=50
#images
self.i0 = pygame.image.load('sprite1.png')
self.i1 = pygame.image.load('sprite2.png')
#frame update
self.timeTarget=10
self.timeNum=0
self.currentImage=0
def update(self):
self.timeNum+=1
if self.timeNum==self.timeTarget:
if self.currentImage==0:
self.currentImage=1
else:
self.currentImage=0
self.timeNum=0
self.render()
def render(self):
if (self.currentImage==0):
windowSurface.blit(self.i0, (self.x, self.y))
else:
windowSurface.blit(self.i1, (self.x, self.y))
def playerHasHitSquare(playerRect, Square):
for s in square:
if Player.coliderect(s['rect']):
return True
return False
def drawTextGrey(text, font, surface, x, y):
textobj = font.render(text, 1, Grey)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextRed(text, font, surface, x, y):
textobj = font.render(text, 1, Red)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextBlue(text, font, surface, x, y):
textobj = font.render(text, 1, Blue)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextGreen(text, font, surface, x, y):
textobj = font.render(text, 1, Green)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextBlack(text, font, surface, x, y):
textobj = font.render(text, 1, Black)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
Player = Sprite (100,150)
font = pygame.font.SysFont(None, 48)
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
windowSurface.fill(White)
# Move the player around.
if moveLeft and Player.x > 0:
Player.x += -5
if moveRight and Player.x < 500:
Player.x += 5
if moveUp and Player.y > 0:
Player.y += -5
if moveDown and Player.y < windowHeight:
Player.y += 5
Player.update()
Clock.tick(60)
pygame.display.flip()

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

View File

@ -0,0 +1,74 @@
import pygame
pygame.init()
window = pygame.display.set_mode((800,600))
pygame.display.set_caption("Window")
x,y=0,0
moveX=0
moveY=0
black = (0,0,0)
white = (255, 255, 255)
clock = pygame.time.Clock()
gameLoop=True
while gameLoop:
for event in pygame.event.get():
if (event.type==pygame.QUIT):
gameLoop=False
if (event.type==pygame.KEYDOWN):
if event.key == pygame.K_LEFT or event.key == ord ('a') :
moveX = -5
if event.key == pygame.K_RIGHT or event.key == ord ('d'):
moveX = 5
if event.key == pygame.K_UP or event.key == ord ('w'):
moveY = -5
if event.key == pygame.K_DOWN or event.key == ord ('s'):
moveY = 5
if (event.type==pygame.KEYUP):
if event.key == pygame.K_LEFT or event.key == ord ('a') :
moveX = 0
if event.key == pygame.K_RIGHT or event.key == ord ('d'):
moveX = 0
if event.key == pygame.K_UP or event.key == ord ('w'):
moveY = 0
if event.key == pygame.K_DOWN or event.key == ord ('s'):
moveY = 0
window.fill(black)
x+=moveX
y+=moveY
pygame.draw.rect(window, white, (x, y, 50, 50))
clock.tick (500)
pygame.display.flip()
pygame.quit()

View File

@ -0,0 +1,107 @@
if moveLeft and playerRect.left > 0:
playerRect.move_ip(-1 * PLAYERMOVERATE, 0)
if moveRight and playerRect.right < WINDOWWIDTH:
playerRect.move_ip(PLAYERMOVERATE, 0)
if moveUp and playerRect.top > 0:
playerRect.move_ip(0,-1 * PLAYERMOVERATE)
if moveDown and playerRect.bottom > 0:
playerRect.move_ip(0, +1 * PLAYERMOVERATE)
moveX,moveY=0,0
class Player:
def __init__(self,x,y):
self.x=x
self.y=y
self.width=30
self.height=30
def render(self):
windowSurface.blit(playerImage, (self.x,slef.y,self.width,self.height))
playerImageSet = pygame.image.load('Player.png')
playerImage = pygame.image.load('Player.png')
playerImageL = pygame.image.load('PlayerL.png')
playerImageR = pygame.image.load('PlayerR.png')
playerImageD = pygame.image.load('PlayerD.png')
playerRectSet = playerImage.get_rect()
playerRect = playerImage.get_rect()
playerRectL = playerImageL.get_rect()
playerRectR = playerImageR.get_rect()
playerRectD = playerImageD.get_rect()
if moveLeft== True:
playerImage=playerImageL
playerRect=playerRectL
if moveRight== True:
playerImage=playerImageR
playerRect=playerRectR
if moveUp== True:
playerImage=playerImage
playerRect=playerRect
if moveDown== True:
playerImage=playerImageD
playerRect=playerRectD
else:
playerImage= playerImageSet
playerRect=playerRectSet
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
moveX=-5
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
moveX=5
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
moveY=-5
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
moveY=-5
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
moveX=0
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
moveX=0
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
moveX=0
if event.key == K_UP or event.key == ord('w'):
moveUp = False
moveX=0
# Move the player around.
if moveLeft== True:
playerImage=playerImageL
playerRect=playerRectL
if moveRight== True:
playerImage=playerImageR
playerRect=playerRectR
if moveUp== True:
playerImage=playerImage
playerRect=playerRect
if moveDown== True:
playerImage=playerImageD
playerRect=playerRectD
playerImage= playerImageSet
playerRect=playerRectSet
, pygame.FULLSCREEN

View File

@ -0,0 +1,24 @@
import pygame
from pygame.locals import *
window = pygame.display.set_mode((600,400))
#
class player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load('Player.png')
self.rect = pygame.Rect(0,0,30,30)
player_object = player()
sprites = pygame.sprite.Group()
sprites.add(player_object)
#
loop = True
while loop == True:
pygame.display.update()
sprites.draw(window)
sprites.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
loop = False
pygame.quit()

View File

@ -0,0 +1,73 @@
import pygame
from pygame.locals import *
window = pygame.display.set_mode((600,400))
#
moveX,moveY=0,0
clock=pygame.time.Clock()
class player(pygame.sprite.Sprite):
def __init__(self,x,y):
pygame.sprite.Sprite.__init__(self)
self.x=x
self.y=y
self.image = pygame.image.load('Player.png')
self.rect = pygame.Rect(self.x,self.y,30,30)
player_object = player(100,100)
sprites = pygame.sprite.Group()
sprites.add(player_object)
#
loop = True
while loop == True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
loop = False
if (event.type==pygame.KEYDOWN):
if event.key==pygame.K_LEFT or event.key == ord('a'):
moveX = -5
if event.key==pygame.K_RIGHT or event.key == ord('d'):
moveX = 5
if event.key==pygame.K_UP or event.key == ord('w'):
moveY = -5
if event.key==pygame.K_DOWN or event.key == ord('s'):
moveY = 5
if event.type==pygame.KEYUP:
if event.key==pygame.K_LEFT or event.key == ord('a'):
moveX = 0
if event.key==pygame.K_RIGHT or event.key == ord('d'):
moveX = 0
if event.key==pygame.K_UP or event.key == ord('w'):
moveY = 0
if event.key==pygame.K_DOWN or event.key == ord('s'):
moveY = 0
player_object.x=moveX
player_object.y=moveY
clock.tick(50)
pygame.display.update()
sprites.draw(window)
sprites.update()
pygame.quit()

142
Python/rect race.py Normal file
View File

@ -0,0 +1,142 @@
import pygame, random, sys, time
from pygame.locals import *
windowWidth = 600
windowHeight = 600
FPS = 6000
Green = (0, 255, 0)
Blue = (0, 0, 255)
Red = (255, 0, 0)
Grey = (100, 100, 100)
Black = (0, 0, 0)
White = (255, 255, 255)
moveLeft,moveRight=0,0
moveUp,moveDown=0,0
pygame.init()
Clock = pygame.time.Clock()
windowSurface = pygame.display.set_mode((windowWidth,windowHeight))
pygame.display.set_caption('Rect Race')
pygame.mouse.set_visible(True)
def terminate():
pygame.quit()
sys.exit()
def waitForPlayerToPressKey():
while True:
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
terminate()
if event.key == K_RETURN:
return
if event.key == ord ('e'):
return
class Sprite:
def __init__(self,x,y):
self.x=x
self.y=y
self.width=50
self.height=50
def render(self):
pygame.draw.rect(windowSurface,White,(self.x,self.y,self.width,self.height))
def playerHasHitSquare(playerRect, Square):
for s in square:
if Player.coliderect(s['rect']):
return True
return False
def drawTextGrey(text, font, surface, x, y):
textobj = font.render(text, 1, Grey)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextRed(text, font, surface, x, y):
textobj = font.render(text, 1, Red)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextBlue(text, font, surface, x, y):
textobj = font.render(text, 1, Blue)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextGreen(text, font, surface, x, y):
textobj = font.render(text, 1, Green)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
def drawTextBlack(text, font, surface, x, y):
textobj = font.render(text, 1, Black)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
Player = Sprite (100,150)
font = pygame.font.SysFont(None, 48)
while True: # the game loop runs while the game part is playing
for event in pygame.event.get():
if event.type == QUIT:
terminate()
if event.type == KEYDOWN:
if event.key == K_LEFT or event.key == ord('a'):
moveRight = False
moveLeft = True
if event.key == K_RIGHT or event.key == ord('d'):
moveLeft = False
moveRight = True
if event.key == K_UP or event.key == ord('w'):
moveUp = True
moveDown = False
if event.key == K_DOWN or event.key == ord('s'):
moveUp = False
moveDown = True
if event.type == KEYUP:
if event.key == K_ESCAPE:
terminate()
if event.key == K_LEFT or event.key == ord('a'):
moveLeft = False
if event.key == K_RIGHT or event.key == ord('d'):
moveRight = False
if event.key == K_DOWN or event.key == ord('s'):
moveDown = False
if event.key == K_UP or event.key == ord('w'):
moveUp = False
windowSurface.fill(Black)
# Move the player around.
if moveLeft and Player.x > 0:
Player.x += -5
if moveRight and Player.x < windowWidth:
Player.x += 5
if moveUp and Player.y > 0:
Player.y += -5
if moveDown and Player.y < windowHeight:
Player.y += 5
Player.render()
Clock.tick(60)
pygame.display.flip()

0
README.md Normal file
View File