For the collision I still had to set a player_hitbox Rect() for it to intersect with the rock , if you look above you'll see my rock code . I tried the
self.frame.intersects(item.frame)
But that doesn't work any idea guys?
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
For the collision I still had to set a player_hitbox Rect() for it to intersect with the rock , if you look above you'll see my rock code . I tried the
self.frame.intersects(item.frame)
But that doesn't work any idea guys?
Okay Guys Something New Here Is The Code
class Rock(SpriteNode):
def __init__(self, **kwargs):
SpriteNode.__init__(self, 'IMG_1726.GIF', **kwargs)
def update (self):
self.spawn_rock
class Rock(SpriteNode):
def __init__(self, **kwargs):
SpriteNode.__init__(self, 'IMG_1726.GIF', **kwargs)
It does what it's suppose to do spawn the rocks, but I want it to spawn 3 rocks at a time. After each rock is destroyed it is randomly generated somewhere else. Not immediately but like a 10 second duration. I tried if and else statements in the update but nothing seems to work , going to keep poking around any input ?
Got everything up and running , it was a indention problem.
Okay guys so everything works but now my touch movement for my Sprite isn't responding here's the original code before I implemented your code ,
x, _= touch.location
_, y = self.player.position
move_action = Action.move_to(x,y,2,TIMING_SINODIAL)
self.player.run_action(move_action)
if (x,_ > 0.05):
self.player.x_scale = cmp(touch.location.x -
self.player.position.x, 0)
x = self.player.position.x
Do I switch it to self.sprite.position
Hmm
Beautiful ccc I think I love you 😂 But for real thank you, you been a big help in my journey.
I dont understand how ai would implement this into my game , but the concept is what I'm looking for being able to see my players/enemy hit box. but I want to implement this with out going thru ui , there has to be a easier way. 🤔 I'm currently trying many different options
Is there a way I can make the Rect around my player a color for debugging purposes I'm fairly new , and I'm sure this is fairly simple but I tried fill_color, set_color nothing worked. Here is the code
player_hitbox = Rect(self.player.position.x - 20, 32, 40, 65,fill_color = "Blur")
So here's the basic code for flipping it with gravity and abs :
def cmp (a, b):
return ((a> _b) - (a < b))
g = gravity()
if abs(g.x) > 0.05:
self.player.x_scale = cmp(g.x, 0)
This basically flips the image horizontally by tilting your device , but how do I go about getting it to flip with touch location. I've tried many variations , one variation I tried only got him to turn on the negative - axis but not the positive. any suggestions? Here is my player movement code btw:
x, _= touch.location
, y = self.player.position
move_action = Action.move_to(x,y,0.7,TIMING_SINODIAL)
self.player.run_action(move_action)
if (x, > 0.05):
self.player.x_scale = cmp(-x, 0)
x = self.player.position.x