Comments (1)
Added in commit aad03e6.
Find the action name in pygame_maker/actions/action.py inside an ACTION_DATA_YAML dict; the order and number of parameters following the action's name should be supplied as arguments to the function.
Therefore, to call create_object_with_velocity()
from user code:
ACTION_DATA_YAML = """
...
create_object_with_velocity:
- object: common_object
- position.x: common_position
- position.y: common_position
- speed: common_speed
- direction:
type: float
default: 0.0
- child_instance:
type: bool
default: False
- relative: common_relative
...
"""
The above excerpt shows the arguments needed:
object
is a string naming an object typeposition.x
is an integer X coordinateposition.y
is an integer Y coordinatespeed
is a decimal number for the object's movement speeddirection
is a decimal number for the direction of motion in degreeschild_instance
if true, means create the new object as a child of the current objectrelative
if true, means interpret position, speed, direction as relative to the current object
The "current object" refers to the object instance that executed the code block.
Remember that the language parser won't recognize bare function calls, so you need to use it in an assignment, E.G.:
ok = create_object_with_velocity('obj_UFO', 20+randint(screen_width-40), 0, 1.0, 180.0, false, false)
This should create an instance of obj_UFO
at the top of the screen that moves downward at 1 pixel per frame. The variable ok
will equal 1 if the action was successfully called, 0 otherwise (these can also be compared with booleans true and false).
from pygame_maker.
Related Issues (10)
- Add Blending modes for sprites HOT 1
- Add Boolean variable support HOT 1
- Add option to disable collision entirely for objects
- Add python 3 support HOT 1
- Make multiple sprites on one object with layering
- Add support for JSON instead of YAML
- mouse_global_left events only fire if cursor is on object HOT 1
- Create a "Getting started" guide
- Add background music support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygame_maker.