0

I am using the panda 3d game engine and I have created a Block class. I need to be able to destroy items in the game but I did not specify a name.

class block code:

class Block:
    def __init__(self, window, cords: tuple):
        box = window.loader.loadModel('models/box')
        box.set_pos(cords[0], cords[1], cords[2])
        box.reparent_to(window.render)

and this is the function I use to create a Block:

def place(window, cords: tuple):
    Block(window, cords)

I also used a nested for loop to create many blocks

error 1044
  • 111
  • 1
  • 6
  • 1
    What do you mean _"destroy items in the game"_? Don't _draw_ them after they're "destroyed" and then use `del block` to delete the object. Where `block = Block(window, cords)`. Store the created objects in a list or some place so you can select them to interact with, if not via your gui framework. – aneroid Nov 07 '21 at 14:03
  • thanks for the idea, i am now storing the created objects in a list!do you know how to delete an object in pandas 3d because the del key word does not work for some reason – error 1044 Nov 07 '21 at 16:23
  • 1
    **1.** [tag:pandas] != [tag:panda3d] One is about data, the other about 3d graphics engine. I've updated your question tags. **2.** Check this question (found via a simple google search) - [How do I delete a model in my game?](https://discourse.panda3d.org/t/how-do-i-delete-a-model-in-my-game/2643) or try the forums there if the response is better than StackOverflow. – aneroid Nov 07 '21 at 18:18

0 Answers0