0

Python game.

I want to make that, having two turtle.Turtle() objects, when one is pressed (the button), the other (player) is moved to a certain position. But I don't know how to make it. Can someone help me?

22nd Dec 2019, 11:08 PM
Eduardo Cavalcante
Eduardo Cavalcante - avatar
4 Antworten
+ 1
I don't really understand your problem. can you be more specific? from what you said I can only give this example: while 1: input = input() if input == "button": print("button pressed") elif input == "exit": break this starts an infinite loop, asking for input on every iteration and displays a message if the input was "button". with objects you can assign properties/methods but as I don't know your code, I can only guess.
23rd Dec 2019, 11:26 PM
grdr
+ 1
Sounds like you should implement a press() and move() method in your class definition of Turtle
23rd Dec 2019, 11:50 PM
grdr
+ 1
is this just theoretical? because in practice you would use a library like PyGame or Arcade, or a game engine that supports python and/or uses a scripting language based on python, such as GDScript in the Godot Engine (Google it). libraries/Frameworks/engines implement a lot of logic you simply need to understand and use, without having to implement it yourself.
23rd Dec 2019, 11:53 PM
grdr
0
Gregor Dietrich I have 2 objects turtle.Turtle(). I wanna add an kinda onClick event in one of they. When the first object is pressed, the second will move to another position (like a game joystick). But I don't know how to make it.
23rd Dec 2019, 11:41 PM
Eduardo Cavalcante
Eduardo Cavalcante - avatar