• I put this code under touch_began() and its how I want. Every time the button is clicked the amount of taps is checked and if it meets the condition it adds 15 to the time.

    if self.tap_count % 20 == 0 and self.tap_count != 0: self.timer_value += 15
  • @mikael ok. That’s a good idea. I’ll add some.

  • @JonB thanks. I defined everything and added the music code and it’s stopping and starting on cue. Thank you for your help. I wasn’t sure how to use the stop resume and pause. I sometimes still have trouble figuring out little things.

  • Thanks so much. I’ve got it working and it feels awesome.

  • @cvp I’ve got it to work with all the other sound effects by using the sound.playeffect(). I think there might be a problem when you use sound.player() with sound.playeffect(). This is what I’m using.

    class MainScene (Scene): def setup(self): bg_music = sound.play_effect('3 card monte beat (90.00 BPM) - MAIN OUT.wav', volume=.25) bg_music.looping = True
  • Found a vid on YouTube that helped me out. I had self in the wrong place and was using the brackets inside of action.call()

    https://youtu.be/IoaD8XYd3jI

  • @ccc would something like this be a good idea?

    position = (self.size.w/2, self.size.h * 1.60)

    If not would be so kind to so me the proper way.

  • @resserone13, it is a feature of scene that in the setup method we already know the size. Very convenient when compared to the ui module.

  • @trey, one idea would be to place a transparent view on top (as a subview of scene.view) to handle the touches.

    Then you would need to check if the touch is near the top-right corner to simulate clicking on the ”x” with superview.close(). And remember to flip the y coordinate before passing the coordinate and touch type to your scene code. And maybe go via screen coordinates if you do a lot of zooming and panning in your scene.

  • Sounds great! Looking forward to it.

  • Thanks guys, I will study about shader and effect more Thanks!

  • @Tonnoaw I would also try to import game_menu.py and build a menu with title and option selection buttons. So, rather than setting “cheat” mode in the script, define a mode button for a non-programmer to change mode of operation.

  • My current approach is to load the tileset.png which contains all the tiles. I then use Image.crop() for every tile I want to extract. I then upscale them using Image.resize() by some arbitrary factor, because if I would let the scene upscale the 8x8 textures to something like 64x64, the performance drops hard. Using BytesIO I convert them to ui.Image without saving them on disk and from there I can load them as a scene.Texture.

    But thank you for the hint that I can load the image and scale them in one operation!

    All I had to do to fix the original problem was converting the tileset.png to RGB mode.

  • @mikael lol well ive never checked the memory lol so in theory this is what i expect lol

  • @stephen 👍

  • @ccc

    I remember seing this a while back and a couple games became helpful for referencing. but i had to go to other websites and translate what they would say about SceneKit so that it made since for scene. if it wasnt for my previous experience with C# and a few third party engines i would of been completly lost.. I just feel it would be helpfull for current and future Pythonistas to have an isolated source to handle such topic. Game Development has been a wonderfull journey this past 8 years or so but by no means has it been easy lol.

  • @cvp - that’s a tremendous help, many thanks.

    For anyone who might want help with ui and scene path drawing when searching in the future, here’s the complete working code (when using the ‘new’ render loop not the classic render loop):

    import ui from scene import * class MyScene (Scene): def setup(self): self.background_color = '#00006b' self.centre = Point(self.size.w/2, self.size.h/2) def update(self): pass def touch_began(self, touch): # Calculate vector between centre point and touched point dx = touch.location.x - self.centre.x dy = touch.location.y - self.centre.y # Draw path from centre point to touched point path = ui.Path() path.line_width = 4.0 path.move_to(-dx,dy) path.line_to(-dx,dy) path.move_to(0,0) path.line_to(dx,-dy) # Create line node from path line = ShapeNode() line.path = path line.position = (self.centre.x, self.centre.y) line.stroke_color = 'white' self.add_child(line) # Place dots at centre and touch points dotA = Dot(location = self.centre) self.add_child(dotA) dotB = Dot(location = touch.location) self.add_child(dotB) class Dot(ShapeNode): def __init__(self, *, location, **kwargs): circle = ui.Path.oval(0,0,20,20) super().__init__(circle, fill_color='white', **kwargs) self.position = (location.x, location.y) run(MyScene())
  • @SmartGoat, also, I toyed with creating a webview-backed UI framework with a Python API that should have been runnable on most platforms (search for ”youey” here), but of course it is a huge amount of work and has been more or less done before – but those other projects have been abandoned, and none of them worked on Pythonista anyway.

  • @cvp Thanks it worked perfectly! And yeah I realized @JonB, now i can adjust parameters since it works. Thank you both very much :)

  • @ccb_2k18 sorry to answer so late but there is a time zone difference😇
    I've seen you posted the same question in another topic and you are right.
    Don't ask a question to only one person, and surely me, there are in this forum a lot of marvelous people, and often a lot smarter than me.

Internal error.

Oops! Looks like something went wrong!