• bashedcrab

    You can publish Swift apps now, so you can avoid Objective-C if you like.

    If you mainly write games (like me), you can't beat ray wenderlich for iOS tutorials.

    http://www.raywenderlich.com/1371/iad-tutorial-for-ios-how-to-integrate-iad-into-your-iphone-app

    posted in Pythonista read more
  • bashedcrab

    https://gist.github.com/BashedCrab/8949577

    This started out as a Flappy Bird clone (can be done in under 100 lines of Pythonista), but I let my son do a bit of a redesign. He decided an underwater setting involving an Octopus was much more enjoyable.

    The game play and physics are tuned to replicate the original Flappy Bird as closely as possible, so it is hard! If you want to make it a bit more fun for young kids, make the gap larger (Default is 360. 450 is much easier but still a challenge for young kids).

    Enjoy.

    posted in Pythonista read more
  • bashedcrab

    https://gist.github.com/9098744

    I've been wanting to do something with the accelerometer for a while, and then I saw this game on the Codea demo movie.

    I've always though doodle jump was a cool game, so here it is on Pythonista.

    It would be cool if someone made the clouds look better, though.

    posted in Pythonista read more
  • bashedcrab

    Hydrogen - https://gist.github.com/BashedCrab/5924965

    HydrogenLayouts - https://gist.github.com/BashedCrab/6103019

    HydrogenDemo - https://gist.github.com/BashedCrab/5953776

    I know a few of you are already using this, but I thought I'd put a post here to help keep track of the project, and let people know when new features are added.

    Wishlist:

    • Better default look&feel
    • More layouts
    • Multiline text components.
    • Tutorial
    • HKeyboard and key events (!)

    Feel free to suggest changes and optimisations to the existing code. I've been programming for a while but only just learning python. Likewise, if you would like to contribute a component or request one, drop something here.

    posted in Pythonista read more
  • bashedcrab

    https://gist.github.com/9062268

    When I said my next game would be more fun, it appears that I lied!

    My daughters class starts every day with 100 math questions in 2 minutes challenge. I created this game to help her practice at home. The 'real' game I've been working on in the background makes extensive use of the PC graphics, so I've incorporated them too.

    Have fun. My best time is 112 seconds.

    posted in Pythonista read more
  • bashedcrab

    There are multiple ways to do this but here is what I do.

    • Upload your .jpg/.png etc files to a photo sharing website (photobucket etc).
    • Take note of the complete url to access just the .jpg (It will look something like http://i427.photobucket.com/albums/pp359/haru2858/starwarscat.jpg)
    • Use urllib to open a link to the jpg.
    • Using the url, save the jpg to your filesystem.
    • Use PIL to load the jpg from your filesystem.
    • Use scene.load pil image() to use within your scene.

    Write your "load_remote_image()" or whatever function to first check if the photo exists on the local file system. If it does exist, go directly to loading it with PIL, else download and save it first using urllib. This way if you share your code, anyone else who runs it will download the image if they don't have it locally. It also means you won't have to download the image every time your code is run.

    posted in Pythonista read more
  • bashedcrab

    You can try Hydrogen to get some UI controls for your Pythonista project.

    https://omz-forums.appspot.com/pythonista/post/5003825878401024

    At least until Pythonista introduces native UIKit controls

    posted in Pythonista read more
  • bashedcrab

    Thanks Sebastian - that looks fantastic. I have updated the Gist with your clouds.

    posted in Pythonista read more
  • bashedcrab

    Hi Tomkirn,

    The game probably took me about an hour or so to get a functional prototype going. I probably spent another 2 - 3 hours, debugging, tuning and making it look nice.

    Hi Upwart,

    When you are in the editor in Pythonista you will see a "+" button up the top. Tap it to bring up a browser of all the built in images, colours, fonts and sounds.

    posted in Pythonista read more
  • bashedcrab

    Hey upwart,
    If you need help getting started with Hydrogen, feel free to ask and I'll get you going. I'm not actively working on it at the moment, but I'm always happy to answer questions.

    Looking at the code for HydrogenDemo is probably the best place to start.

    posted in Pythonista read more
  • bashedcrab

    Also checkout scene.gravity() for accelerometer access.

    If you want to build a 3D app, then Pythonista isn't currently the right tool. Have a look at Unity3D. It is even scriptable with boo (which is basically python).

    As far as physics engines go - you could look at using pynewt. I don't know anything about it though. I can certainly see the appeal of having a 2D rigid body dynamics engine in Pythonista, though. That could certainly make short work of making some types of games. I generally do very simple physics in my games, without trying to do a realistic simulation.

    Next version of Pythonista will very likely have numpy, which would actually make building said rigid body dynamics engine a little easier - I might have a go at it myself.

    posted in Pythonista read more
  • bashedcrab

    Hey TripleC,
    I couldn't decide whether each part of a tower should be it's own object, or if I should aggregate them into one for ease of scoring and collision detection. I went with the aggregate class, but it is probably bad OO design, and it is harder to understand. The Tower class holds 4 Rect()'s. (1 to represent each of the elements of the towers you need to fly through), and then has a draw() function, and an intersects() function for collision detection with the player.

    self.upper_tower is a Rect to represent the shaft that starts at the roof
    self.upper_cap is a Rect to represent the wider 'cap' that sits on the end of the upper tower
    self.lower_tower is a Rect to represent the shaft that starts at the ground
    self.lower_cap is a Rect to represent the wider cap that sits on the end of the lower tower
    

    It draws each of the rects to screen manually - not sure how you would convert it to a layer (or layers).

    posted in Pythonista read more
  • bashedcrab

    You're welcome. Glad someone is enjoying it!

    My next game is a lot less frustrating and a lot more fun.

    posted in Pythonista read more
  • bashedcrab

    It is supposed to be hard. Most players take many tries just to get past the first tower in Flappy Bird. This experiment had the author play 150 times, and still only had a best of 7.

    http://www.wired.com/wiredscience/2014/02/difficult-flappy-bird/

    This gist is modelled as closely as possible on the original Flappy bird to the point the the tower gap/width, scroll speed, jump height, gravity etc make playing this game just as frustrating as the original. If you want to make it accessible for kids, increase the gap. But doing for yourself will destroy the Flappy Bird's addictive quality.

    posted in Pythonista read more
  • bashedcrab

    Grab the latest version of Hydrogen & HydrogenLayouts, then have a play with HCameraApp

    Hydrogen - https://gist.github.com/BashedCrab/5924965

    HydrogenLayouts - https://gist.github.com/BashedCrab/6103019

    HCameraApp - https://gist.github.com/anonymous/6110768

    I probably could have made it shorter/simpler, but I wanted it to look nice. It was very quick to code as it's mainly cut & pasted from the demo.

    posted in Pythonista read more
  • bashedcrab

    Changelog 29-07-13

    • Moved layout managers into separate module
    • Demo code cleaned up and optimised.

    Firstly, big thankyou to CCC who cleaned up HydrogenDemo.py, and replaced all my lazy cut-and-paste GUI code with much more elegant list processing.

    Hydrogen.py was starting to get a bit large and cumbersome to deal with on an iPad so I broke layouts into their own module. Now, if you are laying out your GUI manually, you aren't importing hundreds of lines of unneccessary layout management code. Also the next layout I'm about to add is quite large, and this way Hydrogen.py won't get cluttered up.

    posted in Pythonista read more
  • bashedcrab

    Hi Ole,
    I'd appreciate the option for partial screen rendering in the scene module. So I can start with the previous frame buffer, and only update/change the areas I need rather than having to redraw the entire scene.

    I've started on a branch for Hydrogen that implements a "dirty-region" algorithm to only redraw the areas of screen that need it. However I end up with a black screen and only the newly redrawn areas indicating I'm getting a completely new framebuffer, and I can't see a way to preserve the previously drawn scene.

    posted in Pythonista read more
  • bashedcrab

    In the Images -> Emoji - Objects list the dvd image is shown as blank, and the name listed as 'Dvd'.

    However using 'DVD' as the image name in code works fine.

    posted in Pythonista read more
  • bashedcrab

    I've built a GUI framework for Pythonista that does some of the hard work for you.

    Framework : https://gist.github.com/BashedCrab/5924965

    Demo GUI : https://gist.github.com/BashedCrab/5953776

    It already has sliders and checkboxes (iOS style switches) implemented for you. If you need a hand getting started I can very quicky code up a GUI skeleton for your app for you to experiment with.

    I'll also be releasing an update soon that has much improved rendering performance.

    posted in Pythonista read more
  • bashedcrab

    My pleasure. There is still a lot of refining that needs to be done. Firstly because i am only just starting to learn python, and I'm still discovering the "pythonic" way.

    Secondly I'm probably going to have to abandon my initial design decision of redrawing the entire scene every frame. While it makes to code simpler and is fine for a small gui, it's killing the frame rate for a gui with over 100 components (like the demo).

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!