• Nobody/Anonymous

    I have a problem.

    I am trying to make a mr. black which reappairs on his start spot when he dies. With other words, a mr. black which never dies. But it wasn't as easy as I thought it would be.

    This is what I thought should work:

    (define mr-black (new-mr-black 26.5 35.5))

    (on-event *death* mr-black
    (lambda (subject object)

    But it doesn't seem to work. Do anyone have some advices?

    • Nobody/Anonymous


      sorry that I can't give you a complete and tested answer, since I'm working from abroad for a month i can't test it. Anyway, I think the following code snipped "should" work for you instead:

      (define create-mr-black (subject object)
        (let ((foo (new-mr-black 26.5 35.5)))
          (on-event *death* foo create-mr-black)
          (set-primary-color foo 1.0 1.0 1.0 1.0)
      (create-mr-black nil nil)

      What this would do is to first define a function with one local variable "foo". This variable gets the result of creating a mr-black object and then we make a trigger so that if he dies, then this function is called again. (Creating a new mr-black etc.). 

      Also, just in case you want to do other things with this ball i included the command to eg. change the colour of this ball to white (line 4) and to return the ball to whoever was calling the function (line 5).

      Note that the function accepts two arguments, subject and object, which is needed so it can be called by the event triggerer, but which are ignored.

      good luck

      / Mathias


Log in to post a comment.