S
S
Sergey Murzin2016-05-25 22:25:53
JavaScript
Sergey Murzin, 2016-05-25 22:25:53

What should the parameters of the added game object look like?

Suppose we have a function that takes two arguments: the name of an object and the object itself (or its constructor).
The function that takes arguments creates a game element that consists of:
1. one sprite with a size of one tile
- the width and height are one tile, it has a graphical view and animation.
2. one sprite with an area of ​​​​several tiles
- the width and height are set, there is a graphical view and animation that occupies the entire specified area
3. several sprites and has empty zones
- there are gaps in the specified width and height, in which others may appear during the gameplay objects
- all tiles can have both the same graphical appearance and their own individual ones.
I will give examples.
In the first option, you can imagine some character (for example, Mario) who moves around the game world.
In the second - a building or a large tank, as in strategies.
And in the third - a building with an extension or a machine gun nest in which you can place a machine gunner, or a puzzle piece.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2016-05-26
@xmoonlight

Usually, this is done using a "tree" of dependencies.
It is necessary to distinguish between a "skeleton", a "skin", as well as a behavioral class: role in the plot of the game and processing of reactions to game events: they hit me, I see an enemy/obstacle within a radius R, etc.
Those. you need to transfer to create:
1. Coordinates
2. Tree of sprite objects (identifiers of sprite objects, relative coordinates (from the center of the entire object), their centers of rotation, dependencies of transformations during rotation of the object or each sprite separately)
3. Sprite map for of this tree (partially/completely static or animated)
4. Name of the behavioral class (the role of the object with the processing of reactions to game events)
As a rule, complex dependencies are not made and ordinary objects are always enough and then attach/detach is made from them (the same coordinate displacement and rotation dependency tree) to create a complex one (a walking robot, etc.).
If an empty space needs to be filled with something, they usually do not make it really empty, but put another identifier indicating that there is, for example, a slot for a machine gun. But at the same time, do not give him the attribute SOLID (impassable).
Subtleties - WAGON)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question