{ "info": { "author": "Bottersnike", "author_email": "bottersnike237@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Topic :: Games/Entertainment" ], "description": "# pygame.snake\n\n_Snake supports scenes through the `@game.scene` decorator. This\nREADME doesn't cover them though. Despite that, snake's scenes are\nawesome, look out for the documentation for them when I make it!_\n\n---\n\nSnake has been designed with the absolute beginner in mind.\nNone of that fussing around with `pygame.event.get()`,\n`pygame.display.set_mode()`, `pygame.image.load()`, etc.\n\nIn fact, you can make a game in snake without `import pygame`\nanywhere! A lot of the following code snippets are actually entire\nsnake projects. It's that simple to use.\n\n```py\nimport snake\n\ngame = snake.Game()\n\nwhile True:\n game.next_frame()\n game.assets.player.stamp((0, 0))\n```\n\n`game.assets`? That's the `assets/` folder automatically loaded\nwith file types detected and filtered into the right things for you.\n\n`game.assets.player` could have been `assets/player.png`. It might\nalso have been `assets/player.jpg` or any other image format. Snake\ndoesn't care.\n\nThat's boring. Let's get some user input going on:\n\n```py\nimport snake\n\ngame = snake.Game()\n\nwhile True:\n events = game.next_frame()\n\n if events.keys.space:\n print(\"Space is pressed!\")\n else:\n print(\"Space isn't pressed\")\n```\n\nThat was easy. Notice how the keyboard was dropped into `events.keys`?\nLet's have a look at mouse input:\n\n```py\nprint(\"Mouse is at \" + str(events.mouse.pos))\n```\n\nNice. I wonder if we can scroll?\n\n```py\nif events.scroll.up:\n print(\"Scroll up\")\n```\n\nOh. Nice. My game's a little more advanced though. I'm going to need\nsome sprites. No worries.\n\n```py\nplayer = game.sprite(game.assets.player)\n\nwhile True:\n game.next_frame()\n player.x += 1\n```\n\nToo easy. Onto fonts:\n\n```py\nlabel = game.sprite(game.assets.my_font)\n\nwhile True:\n events = game.next_frame()\n\n if events.keys.space:\n label.text = \"Space is pressed\"\n else:\n label.text = \"Space is not pressed\"\n```\n\nRemember that `game.assets.my_font` is going to be\n`assets/my_font.ttf`, so make sure you have a font file there.\n\nQuitting isn't even something that needs to be covered. It's handled\nimplicitly for you. No problems there.\n\nNow at the moment everything has been working with the origin, but\nthat's boring. Let's add an FPS counter in the top right corner.\n\n```py\ncounter = game.sprite(game.assets.my_font)\ncounter.stick = game.NE\n\nwhile True:\n game.next_frame()\n\n counter.text = str(round(game.fps, 2))\n```\n\nWe've got a few new things here. The important part is\n`counter.stick` which tells snake where to place the sprite.\nNorth-east is the top right which is what we want. The default is\n`game.CENTRE`. The other new thing is `game.fps`. No surprises there;\nit's the FPS.\n\nI don't like the fact the text is mushed right against the side of the\nwindow though. Let's fix that:\n\n```py\ncounter = game.sprite(game.assets.my_font, x=32, y=32)\n```\n\nNow we're offsetting it by 32 pixels in both directions. Easy as\nanything.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Bottersnike/snake", "keywords": "engine python pygame", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pygame.snake", "package_url": "https://pypi.org/project/pygame.snake/", "platform": "", "project_url": "https://pypi.org/project/pygame.snake/", "project_urls": { "Homepage": "https://github.com/Bottersnike/snake", "Source": "https://github.com/Bottersnike/Snake", "Wiki": "https://github.com/Bottersnike/Snake/wiki" }, "release_url": "https://pypi.org/project/pygame.snake/0.0.1a0/", "requires_dist": [ "pygame" ], "requires_python": "", "summary": "The super-simple pygame framework.", "version": "0.0.1a0" }, "last_serial": 4445954, "releases": { "0.0.1a0": [ { "comment_text": "", "digests": { "md5": "1c72d9ecf651884817d80e2356d93530", "sha256": "85c22e36d20a30497e4ee5e75aca1402fa854469614dfaed4095a914701b0633" }, "downloads": -1, "filename": "pygame.snake-0.0.1a0-py3-none-any.whl", "has_sig": false, "md5_digest": "1c72d9ecf651884817d80e2356d93530", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10241, "upload_time": "2018-11-02T20:09:10", "url": "https://files.pythonhosted.org/packages/9d/66/193465970f30130c80749e7f8f9f30156f9062a638bbd095f0931df9017e/pygame.snake-0.0.1a0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "139d87aba579e092f0530d72517c9b31", "sha256": "d588b33a5ada783c8483f57f30ab16fc1486c71e3e0ad4f6cf88e8c7e848d0ea" }, "downloads": -1, "filename": "pygame.snake-0.0.1a0.tar.gz", "has_sig": false, "md5_digest": "139d87aba579e092f0530d72517c9b31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8964, "upload_time": "2018-11-02T20:09:12", "url": "https://files.pythonhosted.org/packages/27/c3/4b48fa89f614b1a3f736a3835d1c5ecfc0c20e79285b394bdbf6e2281660/pygame.snake-0.0.1a0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1c72d9ecf651884817d80e2356d93530", "sha256": "85c22e36d20a30497e4ee5e75aca1402fa854469614dfaed4095a914701b0633" }, "downloads": -1, "filename": "pygame.snake-0.0.1a0-py3-none-any.whl", "has_sig": false, "md5_digest": "1c72d9ecf651884817d80e2356d93530", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10241, "upload_time": "2018-11-02T20:09:10", "url": "https://files.pythonhosted.org/packages/9d/66/193465970f30130c80749e7f8f9f30156f9062a638bbd095f0931df9017e/pygame.snake-0.0.1a0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "139d87aba579e092f0530d72517c9b31", "sha256": "d588b33a5ada783c8483f57f30ab16fc1486c71e3e0ad4f6cf88e8c7e848d0ea" }, "downloads": -1, "filename": "pygame.snake-0.0.1a0.tar.gz", "has_sig": false, "md5_digest": "139d87aba579e092f0530d72517c9b31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8964, "upload_time": "2018-11-02T20:09:12", "url": "https://files.pythonhosted.org/packages/27/c3/4b48fa89f614b1a3f736a3835d1c5ecfc0c20e79285b394bdbf6e2281660/pygame.snake-0.0.1a0.tar.gz" } ] }