-
jackattack
Hey so I actually found a solution on the forum from ages ago. If anyone else is interested you basically have to copy list data source class into a separate module and add in a background colour attribute, works well
-
jackattack
Hey can anyone explain how to edit a table view, I’ve been using listdatasource because the other option was a little confusing to me. When I load the table view it always has a white background for the cells, is there an easy way to edit these cells? Similar question, can I change the text alignment in these cells?
-
jackattack
So been doing some research and manim a maths animation package looks really interesting to me but I don’t know if it is possible to install it on Pythonista, I’m pretty much only used to doing pip installs. I’ve been reading about the installation process for it and I ended up really confused, any help would be appreciated
-
jackattack
Hey I’m trying to use a matlab plot in a today widget using UI. How would I display the plot as an image in the today widget?
-
jackattack
Also the only bit I didn’t really understand was when you set up the button class you used init, but then you did spritenode.init what is this for?
-
jackattack
I’ve learnt so much reading your code, love the way you’ve done so many things, spent ages going through it all. Could you give me any insight into the order you went about writing it?
-
jackattack
Wow this works perfectly thank you so much, I’m going to take some time to study it and try to learn how to recreate it with some other effects. Thanks for taking the time out 😌
-
jackattack
my sprite sheet
Just using one row of this in my code for a basic walk forward animation -
jackattack
Sure can do, what format can I post it on here? I basically just cropped one from online to make it easier to work with
-
jackattack
from scene import * import sound import random import math A = Action sprite_sheet=[Texture('scene_practice/new_sprites/IMG_3039.JPG').subtexture(Rect(0,0.5,0.33,0.25)),Texture('scene_practice/new_sprites/IMG_3039.JPG').subtexture(Rect(0.33,0.5,0.33,0.25)),Texture('scene_practice/new_sprites/IMG_3039.JPG').subtexture(Rect(0.66,0.5,0.33,0.25))] class MyScene (Scene): def setup(self): self.screen="game" self.background_color = 'black' self.Sprite = SpriteNode(sprite_sheet[0],scale = 4, position = (self.size.x/2,self.size.y/1.1), parent = self) self.add_child(self.Sprite) self.n = -1 self.button = SpriteNode('shp:Circle',scale=2,position=(self.size.x/1.5,self.size.y/3)) self.add_child(self.button) def did_change_size(self): pass def update(self): step1 = int(self.Sprite.position.y / 15) % 3 if step1 != self.n: self.Sprite.texture = sprite_sheet[step1] def touch_began(self, touch): moveaction = Action.move_by(0,-46) if touch.location in self.button.bbox: self.Sprite.run_action(moveaction) if __name__ == '__main__': run(MyScene(), show_fps=False)
Okay so here is a basic version of what I have been doing.
So in my Update method I’m using the y coordinate of my sprite to return an integer 0 or 1 or 2, then I’m using this as a reference To set the texture from my spritesheet, basically just what was being done in the game tutorial.
The thing I’m stuck with is how I can expand this idea to another direction, so for instance if I wanted to go up instead of down I would need to use an entirely different sprite sheet but I don’t know how to do that
What I would really like to do if possible is tie the whole animation process to the button press so I could animate a more diverse range of things not just relying on position? Does that make sense?
I’m so grateful for you guys taking time to read my stuff and help, gives me real motivation to keep learning, so thanks again everyone
-
jackattack
Hey thanks so much for getting back to me, I’ll take a look at the examples, I’m a bit busy myself at the moment but I’ll try to get the code I’m using to you ASAP. Be warned it’s a hot mess cause I’m just practicing some ideas at the moment, and I’m also very bad at this 😂
-
jackattack
I was wondering is this could be done with Action.call()? I have never used this feature and can’t really get it working so if someone could give me an example of how to set up a custom action I might be able to adapt that to my needs
-
jackattack
Hey people very new to all this but having a great time. So here’s the issue, I’ve been working on sprite animation, using the change texture feature and a sprite sheet. What I now want is for my sprite animation to happen when I run an action. So for example I press a move down button and my character transitions through a walking animation. I can’t figure out a way to get something like this to happen.
My main issue is that for my animation to work it needs to be in Update and all my actions are in touch began.
I’ve seen the game tutorial using the players position to update the spritesheet but I don’t know how this would work for different directions, like up, down, left, right.
Anyway I hope this question makes some sense, I’ve been working really hard to improve but just can’t seem to figure this one out, any help is really truly appreciated