diff --git a/Pipfile b/Pipfile index 9534830..d65d2e9 100644 --- a/Pipfile +++ b/Pipfile @@ -6,6 +6,7 @@ verify_ssl = true [dev-packages] [packages] +arcade = "*" [requires] python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..28d9e00 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,101 @@ +{ + "_meta": { + "hash": { + "sha256": "59765d454c7bd8f4f9a0e913821a007b529b538d47c41ba6b87094231c6ed813" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.6" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "arcade": { + "hashes": [ + "sha256:0ec8572d15f504ed081385d3d121a4647c0c4c0b3dcd5e0ed1ff9d49296f792d" + ], + "index": "pypi", + "version": "==2.3.15" + }, + "attrs": { + "hashes": [ + "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", + "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72" + ], + "version": "==19.3.0" + }, + "numpy": { + "hashes": [ + "sha256:1598a6de323508cfeed6b7cd6c4efb43324f4692e20d1f76e1feec7f59013448", + "sha256:1b0ece94018ae21163d1f651b527156e1f03943b986188dd81bc7e066eae9d1c", + "sha256:2e40be731ad618cb4974d5ba60d373cdf4f1b8dcbf1dcf4d9dff5e212baf69c5", + "sha256:4ba59db1fcc27ea31368af524dcf874d9277f21fd2e1f7f1e2e0c75ee61419ed", + "sha256:59ca9c6592da581a03d42cc4e270732552243dc45e87248aa8d636d53812f6a5", + "sha256:5e0feb76849ca3e83dd396254e47c7dba65b3fa9ed3df67c2556293ae3e16de3", + "sha256:6d205249a0293e62bbb3898c4c2e1ff8a22f98375a34775a259a0523111a8f6c", + "sha256:6fcc5a3990e269f86d388f165a089259893851437b904f422d301cdce4ff25c8", + "sha256:82847f2765835c8e5308f136bc34018d09b49037ec23ecc42b246424c767056b", + "sha256:87902e5c03355335fc5992a74ba0247a70d937f326d852fc613b7f53516c0963", + "sha256:9ab21d1cb156a620d3999dd92f7d1c86824c622873841d6b080ca5495fa10fef", + "sha256:a1baa1dc8ecd88fb2d2a651671a84b9938461e8a8eed13e2f0a812a94084d1fa", + "sha256:a244f7af80dacf21054386539699ce29bcc64796ed9850c99a34b41305630286", + "sha256:a35af656a7ba1d3decdd4fae5322b87277de8ac98b7d9da657d9e212ece76a61", + "sha256:b1fe1a6f3a6f355f6c29789b5927f8bd4f134a4bd9a781099a7c4f66af8850f5", + "sha256:b5ad0adb51b2dee7d0ee75a69e9871e2ddfb061c73ea8bc439376298141f77f5", + "sha256:ba3c7a2814ec8a176bb71f91478293d633c08582119e713a0c5351c0f77698da", + "sha256:cd77d58fb2acf57c1d1ee2835567cd70e6f1835e32090538f17f8a3a99e5e34b", + "sha256:cdb3a70285e8220875e4d2bc394e49b4988bdb1298ffa4e0bd81b2f613be397c", + "sha256:deb529c40c3f1e38d53d5ae6cd077c21f1d49e13afc7936f7f868455e16b64a0", + "sha256:e7894793e6e8540dbeac77c87b489e331947813511108ae097f1715c018b8f3d" + ], + "version": "==1.18.2" + }, + "pillow": { + "hashes": [ + "sha256:04a10558320eba9137d6a78ca6fc8f4a5801f1b971152938851dc4629d903579", + "sha256:0f89ddc77cf421b8cd34ae852309501458942bf370831b4a9b406156b599a14e", + "sha256:251e5618125ec12ac800265d7048f5857a8f8f1979db9ea3e11382e159d17f68", + "sha256:291bad7097b06d648222b769bbfcd61e40d0abdfe10df686d20ede36eb8162b6", + "sha256:2f0b52a08d175f10c8ea36685115681a484c55d24d0933f9fd911e4111c04144", + "sha256:3713386d1e9e79cea1c5e6aaac042841d7eef838cc577a3ca153c8bedf570287", + "sha256:433bbc2469a2351bea53666d97bb1eb30f0d56461735be02ea6b27654569f80f", + "sha256:4510c6b33277970b1af83c987277f9a08ec2b02cc20ac0f9234e4026136bb137", + "sha256:50a10b048f4dd81c092adad99fa5f7ba941edaf2f9590510109ac2a15e706695", + "sha256:670e58d3643971f4afd79191abd21623761c2ebe61db1c2cb4797d817c4ba1a7", + "sha256:6c1924ed7dbc6ad0636907693bbbdd3fdae1d73072963e71f5644b864bb10b4d", + "sha256:721c04d3c77c38086f1f95d1cd8df87f2f9a505a780acf8575912b3206479da1", + "sha256:8d5799243050c2833c2662b824dfb16aa98e408d2092805edea4300a408490e7", + "sha256:90cd441a1638ae176eab4d8b6b94ab4ec24b212ed4c3fbee2a6e74672481d4f8", + "sha256:a5dc9f28c0239ec2742d4273bd85b2aa84655be2564db7ad1eb8f64b1efcdc4c", + "sha256:b2f3e8cc52ecd259b94ca880fea0d15f4ebc6da2cd3db515389bb878d800270f", + "sha256:b7453750cf911785009423789d2e4e5393aae9cbb8b3f471dab854b85a26cb89", + "sha256:b99b2607b6cd58396f363b448cbe71d3c35e28f03e442ab00806463439629c2c", + "sha256:cd47793f7bc9285a88c2b5551d3f16a2ddd005789614a34c5f4a598c2a162383", + "sha256:d6bf085f6f9ec6a1724c187083b37b58a8048f86036d42d21802ed5d1fae4853", + "sha256:da737ab273f4d60ae552f82ad83f7cbd0e173ca30ca20b160f708c92742ee212", + "sha256:eb84e7e5b07ff3725ab05977ac56d5eeb0c510795aeb48e8b691491be3c5745b" + ], + "version": "==7.1.1" + }, + "pyglet": { + "hashes": [ + "sha256:bd96b9c374a7192e4787f989e8f911719476c71476466a02312839e8cb6a0d4e", + "sha256:c54d897d96bf65689bfaf094330ba3dc76af24daf74e7d98336157fd82b72f1b" + ], + "version": "==1.5.3" + }, + "pytiled-parser": { + "hashes": [ + "sha256:7664f5ed291fa51bad131c0f844f80c81ee604c768eb05ebe29530ddff4a0000" + ], + "version": "==0.9.3" + } + }, + "develop": {} +} diff --git a/images/Characters/platformChar_idle.png b/images/Characters/platformChar_idle.png new file mode 100644 index 0000000..fa3723f Binary files /dev/null and b/images/Characters/platformChar_idle.png differ diff --git a/images/Characters/platformChar_jump.png b/images/Characters/platformChar_jump.png new file mode 100644 index 0000000..7af6e2f Binary files /dev/null and b/images/Characters/platformChar_jump.png differ diff --git a/images/Characters/platformChar_walk1.png b/images/Characters/platformChar_walk1.png new file mode 100644 index 0000000..1aa5d9b Binary files /dev/null and b/images/Characters/platformChar_walk1.png differ diff --git a/images/Characters/platformChar_walk2.png b/images/Characters/platformChar_walk2.png new file mode 100644 index 0000000..170b41b Binary files /dev/null and b/images/Characters/platformChar_walk2.png differ diff --git a/images/Tiles/platformPack_tile001.png b/images/Tiles/platformPack_tile001.png new file mode 100644 index 0000000..614891b Binary files /dev/null and b/images/Tiles/platformPack_tile001.png differ diff --git a/platformer.py b/platformer.py index 7e06d0e..334fd76 100644 --- a/platformer.py +++ b/platformer.py @@ -1,3 +1,6 @@ +""" +Platformer Game +""" import arcade # Constants @@ -5,6 +8,12 @@ SCREEN_WIDTH = 1000 SCREEN_HEIGHT = 650 SCREEN_TITLE = "Platformer" +# Constants used to scale our sprites from their original size +CHARACTER_SCALING = 1 +TILE_SCALING = 1 +COIN_SCALING = 0.5 + + class MyGame(arcade.Window): """ Main application class. @@ -15,17 +24,61 @@ class MyGame(arcade.Window): # Call the parent class and set up the window super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) + # These are 'lists' that keep track of our sprites. Each sprite should + # go into a list. + self.coin_list = None + self.wall_list = None + self.player_list = None + + # Separate variable that holds the player sprite + self.player_sprite = None + arcade.set_background_color(arcade.csscolor.CORNFLOWER_BLUE) def setup(self): """ Set up the game here. Call this function to restart the game. """ - pass + # Create the Sprite lists + self.player_list = arcade.SpriteList() + self.wall_list = arcade.SpriteList() + self.coin_list = arcade.SpriteList() + + # Set up the player, specifically placing it at these coordinates. + image_source = "images/Characters/platformChar_idle.png" + self.player_sprite = arcade.Sprite(image_source, CHARACTER_SCALING) + self.player_sprite.center_x = 64 + self.player_sprite.center_y = 128 + self.player_list.append(self.player_sprite) + + # Create the ground + # This shows using a loop to place multiple sprites horizontally + for x in range(0, 1250, 64): + wall = arcade.Sprite("images/Tiles/platformPack_tile001.png", TILE_SCALING) + wall.center_x = x + wall.center_y = 32 + self.wall_list.append(wall) + + # Put some crates on the ground + # This shows using a coordinate list to place sprites + coordinate_list = [[512, 96], + [256, 96], + [768, 96]] + + for coordinate in coordinate_list: + # Add a crate on the ground + wall = arcade.Sprite("images/Tiles/platformPack_tile028.png", TILE_SCALING) + wall.position = coordinate + self.wall_list.append(wall) def on_draw(self): """ Render the screen. """ + # Clear the screen to the background color arcade.start_render() - # Code to draw the screen goes here + + # Draw our sprites + self.wall_list.draw() + self.coin_list.draw() + self.player_list.draw() def main(): @@ -36,4 +89,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()