• SteveIves

    I'm trying to put a UI on a classic 'Star Trek' game written in Python.

    To start with, I want a full-screen background onto which I can put my long-range scanner, my short range scanner, a command menu and perhaps some other boxes.

    Would I create a full-screen ui.view for the background and then ui.view subviews for the scanners etc?

    Thanks,

    Steve

    posted in Pythonista read more
  • SteveIves

    The current version, which runs under Pythonista, looks like this :
    alt text

    When you enter your command, the game's status is simply printed as text and everything scrolls up, and you are then prompted to enter your command again.

    posted in Pythonista read more
  • SteveIves

    Hi. no, this is basically the original text-based Star Trek with text input and output. the UI I'm aiming for is something like this : alt text

    so you enter your move as text and the status of the universe is then updated and the screen re-drawn.

    posted in Pythonista read more
  • SteveIves

    Just found this and notices that the sprites png file has been moved. Can it be found elsewhere or do you mind if I create my own?

    Thanks,

    Steve

    posted in Pythonista read more
  • SteveIves

    I've found a Python version of the classic text-based 'Star Trek' game. It writes loads of text to the console for star-field displays etc.

    I'd like to rewrite it with a static text display that updates in place, and though that the 'scene' module would be the best way to do it, but I'm obviously not understanding how the 'scene' module works.

    For example: I want to display the intro text, so I've coded the following:

        import console
        from scene import *
        import time
    
        class MyScene(Scene):
    
            def draw(self):
                    pass
    
            def setup(self):
                    global screen
                    screen = self.size
                    w, h = self.size.w, self.size.h
                    self.graphicBlurb()
    
            def graphicBlurb(self):
                    blurb = []
                    blurb.append("Space ... the final frontier.")
                    blurb.append("These are the voyages of the starship Enterprise")
                    blurb.append("Its five year mission ...")
                    blurb.append("... to boldly go where no-one has gone before")
                    blurb.append("You are Captain Kirk.")
                    blurb.append("Your mission is to destroy all of the Klingons in the galaxy.")
    
                    #font_size = 60 if self.size5.w > 700 else 40
                    yOffset = screen.h/(len(blurb))
                    yPos = screen.h
                    for line in blurb:
                            text(line,'GillSans',40,screen.w/2,yPos)
                            print "Printing {0} {1}".format(line,time.localtime())
                            time.sleep(1.5)
                            yPos -= yOffset
    
        trekGame = MyScene()
        run(trekGame)
    
    

    but when I run this, instead of the lines of text appearing one at a time down the screen, I get a black screen for about 10.5 seconds, then all the text appears at once.

    I'm guessing that it's running the 'setup' method but nothing is appearing on screen until the 'draw' method is called.

    What's the best way to do this, or is 'scene' only for programs that need to 60fps gameloop and should I be using the 'ui' module instead?

    Thanks,

    Steve

    posted in Pythonista read more
  • SteveIves

    Thanks Jon. As this is a text-heavy game, I think that a 'ui' based interface will work better.

    posted in Pythonista read more
  • SteveIves

    Hi,

    Just getting started with using the Pythonista UI builder.

    If I select 'Script with UI' and I call my file 'Test UI', then I get an empty Test UI.pyui file and a Test UI.py file with just an 'import ui' in it. Touching the button on the screen flip-flops between the 2 files.

    Am I correct in thinking that my actual code goes in a separate source file (e.g. Test Code.py) in which I reference 'Test UI', or should my code go in the 'Test UI.py' file?

    Thanks in advance for advice.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!