Editing Creating Custom Events

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 20: Line 20:
'''core/components/event/conditions/core.py'''   
'''core/components/event/conditions/core.py'''   


<code>
     python
     python
     ...
     ...
Line 27: Line 28:
     return True
     return True
     ...
     ...
</code>


Notice that ''every'' condition must have these two parameters:   
Notice that ''every'' condition must have these two parameters:   
Line 37: Line 39:


Here's an example of what you might get back as a condition you define in [http://www.mapeditor.org Tiled]:   
Here's an example of what you might get back as a condition you define in [http://www.mapeditor.org Tiled]:   
<code>python


    python
>>> condition
    condition
 
    {'id': 3,
{'id': 3,
    'operator': 'is',
 
    'parameters': '1',
'operator': 'is',
    'type': 'always_true',
 
    'x': 1,
'parameters': '1',
    'y': 3}
 
'type': 'always_true',
 
'x': 1,
 
'y': 3}
</code>


After creating your condition, you can now open up [Tiled](http://www.mapeditor.org) and create a new event with your condition!
After creating your condition, you can now open up [Tiled](http://www.mapeditor.org) and create a new event with your condition!
Line 57: Line 66:


'''core/components/event/actions/core.py'''   
'''core/components/event/actions/core.py'''   
<code>python
...
def say_hello(self, game, action):
<nowiki>    </nowiki>print "Hello World!"
<nowiki>    </nowiki>print "    Action:", action


    python
...
    ...
</code>
    def say_hello(self, game, action):
    print "Hello World!"
    print "    Action:", action
    ...


Notice that ''every'' action must have these two parameters:   
Notice that ''every'' action must have these two parameters:   
Line 74: Line 88:


Here's an example of what an action might look like:   
Here's an example of what an action might look like:   
<code>python
>>> action


    python
('say_hello', 'Hi', '3', 1)
    >>> action
</code>
    ('say_hello', 'Hi', '3', 1)


After creating your action, you can now open up [http://www.mapeditor.org Tiled] and include it in your event!
After creating your action, you can now open up [http://www.mapeditor.org Tiled] and include it in your event!

Please note that all contributions to Tuxepedia are considered to be released under the Creative Commons Attribution-ShareAlike (see Tuxepedia:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)