Gridarta Editor
GameObjectCreator.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.var.crossfire.model.gameobject;
21 
30 import org.jetbrains.annotations.NotNull;
31 
36 public class GameObjectCreator {
37 
41  @NotNull
42  private final Archetype archetype;
43 
47  @NotNull
49 
53  @NotNull
55 
59  public GameObjectCreator() {
60  final FaceObjects faceObjects = new DefaultFaceObjects(false);
61  final ResourceIcons resourceIcons = new ResourceIcons();
62  faceObjectProviders = new FaceObjectProviders(1, faceObjects, resourceIcons);
63  animationObjects = new DefaultAnimationObjects();
64  archetype = new DefaultArchetype("arch", faceObjectProviders, animationObjects);
65  }
66 
72  @NotNull
73  public GameObject newGameObject(final int elevation) {
74  final GameObject gameObject = new GameObject(archetype, faceObjectProviders, animationObjects);
75  if (elevation != 0) {
76  gameObject.setAttributeInt(GameObject.ELEVATION, elevation);
77  }
78  return gameObject;
79  }
80 
81 }
final Archetype archetype
The Archetype for created game objects.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for created game objects.
Base package of all Gridarta classes.
AnimationObjects is a container for AnimationObjects.
FaceObjects is a container for FaceObjects.
void setAttributeInt(@NotNull final String attributeName, final int value)
Main package of Gridarta4Crossfire, contains all classes specific to the Crossfire version of the Gri...
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
Abstract base implementation of AnimationObjects.
Creates ImageIcon instances from resources.
GameObject newGameObject(final int elevation)
Creates a new GameObject.
static final String ELEVATION
The name of the "elevation" attribute.
Definition: GameObject.java:52
Abstract base implementation of FaceObjects.
final AnimationObjects animationObjects
The AnimationObjects for created game objects.