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 | |||
>>> condition | |||
{'id': 3, | |||
'operator': 'is', | |||
'parameters': '1', | |||
'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 | |||
... | |||
</code> | |||
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 | |||
('say_hello', 'Hi', '3', 1) | |||
</code> | |||
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! |