Our new games on Play Store:
https://play.google.com/store/apps/developer?id=Best+free+games
please support us for download and give our games rating.
GDX document using ver 1.2.2 Engine à 1.2.5
https://play.google.com/store/apps/developer?id=Best+free+games
please support us for download and give our games rating.
GDX document using ver 1.2.2 Engine à 1.2.5
Some of the features added in this version are:
• Integrate the A * algorithm
• Add InputEvent for game components
• Completed Tower Defense Game
View Game:
Download:
Game made from libgdx so i can play on PC! Jar file you can download here: https://docs.google.com/file/d/0B9TsWVI1UbkKMGlmRTBOcXdyT3c/edit?usp=sharing
Then install the JRE and always play jar files (double-click)
Source of game in engine v.1.26 download: https://docs.google.com/file/d/0B9TsWVI1UbkKdWlncURqNHJxTEE/edit?usp=sharing
Engine Document:
https://drive.google.com/file/d/0B9TsWVI1UbkKbHpiekh6ajdLSXM/view?usp=sharing
Engine Document:
https://drive.google.com/file/d/0B9TsWVI1UbkKbHpiekh6ajdLSXM/view?usp=sharing
This document overview of
the main features of GDX Engine
Update:
1.2.4
Create the ability to automatically load resource by class
Texture Texture2 = AssetLoader.load("data/2.png");
Texture Texture3 = AssetLoader.load("data/3.png");
// ...
For above example, you set the class
of asset will load (Texture). Then you call the load method and pass the path
to the asset. That's it, that engine will load up and asset returns true class for
loading your textures. method setAssetClass should be called to determine the
type of asset that you want to load first. After all textures loaded, you might
want to load BitmapFont, you must set the BitmapFont class in setAssetClass method.
And the load is similar to the
texture.
Additional features of the scene created using UIManager ui
Illustrations by Video i posted in
gdengine.blogspot.com. UIManager will have a Main Menu for
Scene and other ui components (Button, checkbox...) . If Main Menu ‘s visible,
it will block another update of the scene and Gameplay go normal if you turn
off the main menu.
Recommendation you should start
creating UIManager by override the method setupUIManager (String) of Scene the
class you are taking:
@ Override
public void setupUIManager (String skinPath)
{// create newuiManager and
superskin.setupUIManager(skinPath);
/ / Next, create the UI component and add it to uiManager
/ / ...
superskin.setupUIManager(skinPath);
/ / Next, create the UI component and add it to uiManager
/ / ...
The following
example creates a button (Image and toggle button):
ImageButton iconButton = new ImageButton (style);
Button buttonMulti
= new TextButton("Hello!" skin, "toggle");
The ui component as Button, CheckBox ... is from the libgdx framework.
You go to libgdx documentation to know how to create them. After ui already
have, you can add it directly to uiManager:
uiManager.AddActor (iconButton);
/ / you're done, iconButton will uiManager update and drawdone automatically
/ / you're done, iconButton will uiManager update and drawdone automatically
if you create the main menu of scene. For example, when you play Starcraft II, you press F10, it will drop the main menu and pause the game so that players can use the menu, adjust settings or restart the game ... you need a method getWindows () to get the main menu. After that, you can call add () of window to add the UI on the main menu of the scene
uiManager.getWindows().defaults().spaceBottom(10);
uiManager.getWindows().row().fill().expandX();
uiManager.getWindows().add(buttonMulti);
uiManager.getWindows().add(btnCloseMenu);
uiManager.getWindows().add(imgToggleButton);
Menu of Libgdx
using TableLayout, you read the libgdx documentation to learn more about
TableLayout. I explain some method in above code:
row() Creates
a new line on the TableLayout
add () Add a
ui the current cell in the current row of TableLayout. Then if you call add ()
again, the next ui will add to the next cell in the row.
TableLayout is
currently with four column and then row () method is called, it cause a new
table row is created. This row will of course also have four columns as the row
above (Table layout)
Row second you
can still call the add () to add ui normally. You do not need to worry about
the size of the table, as long as you remember to call the method pack () it
will automatically resize to fit your design.
UiManager.GetWindows (). Pack ();
You can use
ChangeListener to control the behavior of the UI, for example:
btnShowMenu.addListener(new ChangeListener ()
{@Override
public void changed (ChangeEvent event, Actor actor) {
});
Button above, when clicked on will be referred to the changed method ()
of ChangeListener. It will be called the method setMenuVisible. of uiManager. Read the method name to make you guess how it works,
right? It will show the Main Menu of the scene I mentioned above.
Create Tab Panel
If you used to
create java swing app, you will see a menu tab. However GDX Engine is to make
the game, not the app, so the original will not be any UI Tab Menu as such, i
have coded the tab pane for the engine: 3
To use the tabbed
panel, you need to declare it:
TabPane pane = new TabPane (2)
Parameter 2 is
the number of tabs will be, here are 2 tab panels.
, then add ui
to uiManager:
uiManager.addActor (pane);
Then you add
tabs for TabPanel , and set the default active tab:
pane.addTab("Tab1",tab1,
skin);
pane.addTab("Tab2",tab2, skin);
In
setActiveTab (int), index is
0 is the first
tab, 1 is the second tab ...
And tab1, tab2
is TabContent, which is a interface ITabContent that you can use to create
anonymous class instance:
ITabContent tab1 = new ITabContent()
{@Override
public void setContent (Table content)
{content.clear();
content.row
(.) expand ();
content.add
(label1);
content.pack
();}
@ Override
public float getHeight ()
{return label1.getHeight
();}
@ Override
public float getWidth ()
{return label1.getWidth
();}};
Above code has
two methods of taking the tab content size. Method setContent () to set the
tabContent content. On his first try add label to TabContent. Of course how
much you want to add UI to be as well. tabContent also use TableLayout.
Additional Action ActionManager management.
Action is an
action of a game object after a certain time. Illustrations used in demo Action
and ActionManager CatchDrop, automatically create new drop after 5 seconds.
Firstly, you
need to have ActionManager, create it in your Scene classes:
ActionManager am = new ActionManager();
ActionManager am = new ActionManager();
services.AddService
(am),
you add it to GameService, then update it in the update method of the scene:
you add it to GameService, then update it in the update method of the scene:
am.Updates (gametime)
If you use the
action, you get ActionManager from GameService, then add your Action:
@
Override
public void initialize ()
{ActionManager am =
getGameServices (). getService(ActionManager.classes);
/ / create a sẽ Perform action
after each 5 seconds
BaseSimpleAction
action = new BaseSimpleAction(false, 5f)
{@Override
{addItem(new
Drop
());}};
am.addActionToDefault
(action);}
It is
recommended from the getService method initialize method ()to avoid bug GameComponent. Action on using BaseSimpleAction It is extremely easy to
use, as you can see, false passed to pause, pause that is false, action will be
executed as soon as add on after 5s (2nd parameter in the constructor). If
Pause is true, then there is no action after 100s happen ;)
After 5s,event onActionPerformance will be known when it will
drop to add new one for DropCollection (above code is in class DropCollection):
@ Override
public void onActionPerformance(){
addItem(new
Drop
());}
Update: 1.2.3
Supports automatic camera zoom and
locate the tiled scene, watch video below illustrates this feature in the demo
"Angry bird" Fix not display properly in game screen resolution
different. Additional constants for some TiledScene, to set the parameters of
the scene as the targeted size, world size, scale values ...
Using not be easier! You call the
method setupCamera (); Scene Of class you are taking and
that's it, the engine will do everything for you.
Sometimes the frame rate of the
device (Width / Height) will be different than if you design the game, This
common ratio is now 4:3 and 16:9. Default Engine will stretch to fit the
screen. If you do not want that, you can use the method keepGameAspectRatio
() of the
scene to keep the frame rate as you have designed. (When the engine will crop
away some parts to fit on the screen)
Update: 1.2.2
Additional PhysicsManager initialize
and update all physical objects in your game, so you do not have to use that
PhysicsScene can use any one scene, then create PhysicsManager and add
PhysicsManager as a game component for that scene. A new interface is
IPhysicsObject to identify a physical object in the game, so you are not forced
to use PhysicsObject class that means it can use any class game component to implement
IPhysicsObject interface, then it is possible to add to PhysicsManager or
PhysicsScene.
demo source code "Angry
Birds" has been revised to illustrate the use and PhysicsManager
IPhysicsObject.
PhysicsManager Usage of similar
PhysicsScene. You only need to change the method of PhysicsScene by method
PhysicsManager object is
Body body = addDynamicBoxObject
(brick, object.width, object.height)
Body body = physicManager.addDynamicBoxObject (brick, object.width,
object.height);
(a brick is physicsSprite or IPhysicsObject interface)
physic manager automatically update
and render all your physicsObject, you just add the manager to the Scene of the
physic engine, and the engine will take care of all of physicsObject update and
draw for you!
For more details, the source code Demo "Angry Birds
"I did and I got some comments there.