Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 6:12 pm

All times are UTC




Post new topic Reply to topic  [ 170 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11, 12  Next
Author Message
 Post subject:
PostPosted: Tue Sep 06, 2011 12:52 pm 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
I've tried with Android 2.2 and this is my result (same on phone, here desktop version)

Image

can you explain what I need to do ?

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2011 2:03 pm 
Offline

Joined: Tue Aug 16, 2011 2:17 am
Posts: 31
Location: Phoenix
Gornova81 wrote:
I've tried with Android 2.2 and this is my result (same on phone, here desktop version)

Image

can you explain what I need to do ?


You've done everything right, that's all i've coded for the MarteEngine AE so far. It does show however, that MarteEngine works on Android. The reason I havn't coded the example project I posted any further is because I cannot get the input in Paddle.java to work. The game was essentially going to be a brick breaker clone.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2011 2:38 pm 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
ok, right, now I've got it :D

I've re-done your example to a most basic one, with Android and MarteEngine (v0.3 in development), for anyone want to start from a template project.

click here to download

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2011 3:22 pm 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
write also a post on blog about this topic, here:

http://randomtower.blogspot.com/2011/09 ... -with.html

we need to refine this process, my aim to have something like:
1) one desktop project as template for MarteEngine+slick+lwjgl all setup and ready to run,
2) one android project with launcher for desktop project

any ideas on that ?

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2011 8:06 pm 
Offline

Joined: Tue Aug 16, 2011 2:17 am
Posts: 31
Location: Phoenix
Gornova81 wrote:
write also a post on blog about this topic, here:

http://randomtower.blogspot.com/2011/09 ... -with.html

we need to refine this process, my aim to have something like:
1) one desktop project as template for MarteEngine+slick+lwjgl all setup and ready to run,
2) one android project with launcher for desktop project

any ideas on that ?


What do you mean?
And has anyone figured out why my input methods are not working? They should work on at least the desktop launcher.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2011 8:17 pm 
Offline
Regular

Joined: Sun Oct 25, 2009 5:24 pm
Posts: 118
I've had a look and you're doing everything right. So it has to be a problem with the AE API, the ApplicationGDXContainer probably.

I have no experience with Slick AE, sadly.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2011 8:32 pm 
Offline

Joined: Tue Aug 16, 2011 2:17 am
Posts: 31
Location: Phoenix
Biki wrote:
I've had a look and you're doing everything right. So it has to be a problem with the AE API, the ApplicationGDXContainer probably.

I have no experience with Slick AE, sadly.


Odd, hopefully someone can figure it out. Or.. take a look at the example project and see how the creator of that implemented input.

EDIT: Or wait, there is no Android Marte Engine examples with input.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2011 7:20 am 
Offline

Joined: Tue Aug 16, 2011 2:17 am
Posts: 31
Location: Phoenix
Sorry for double post but i have the solution. Very obvious, Slick-AE uses Libgdx to work with Android. Well, below is what needs to be added onto whichever entity you want input to be given. Adding it to world (probably your main class too) acts as a sort of global input, while adding it to specific entity will allow it to interact with inner methods/only work when that entity is created.
Code:
yourClassName extends World implements ApplicationListener, InputProcessor {
   // !! Remember to override all other required methods !!
   ...

   @Override
   public void create() {
        Gdx.input.setInputProcessor(this);
        Gdx.input.setCatchBackKey(true);
        // rest of your stuff...
   }

   ...

   @Override
   public boolean keyDown(int keycode) {
        if(keycode == Keys.BACK){
           // Do your optional back button handling (show pause menu?)
        }
        return false;
   }

   ...
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2011 7:45 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
cool!

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2011 5:59 am 
Offline

Joined: Tue Aug 16, 2011 2:17 am
Posts: 31
Location: Phoenix
So i have a level generator that reads the text file by line and makes each character into an entity spawn using

case EXPLANATION_TILE:
world.add(new Tile_Explanation(x, y));
break;
case DEBU5_TILE:
world.add(new Tile_Debu5(x, y));
break;
}

How can I individually reference each of these entities being created? Like if i wanted to call a method on the block being clicked, how do i specifically say, do this method to that block?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2011 6:41 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
check on click on update method of entity :D

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2011 6:54 am 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Or store them in an array while creating them and later on in the world's update method check for the mouse click, retrieve the proper array position based on mouse position and call the method on the entity.

Should be a bit less resource hungry because not all entities check on every update if they are clicked...

Depends on the number of entities that you want to react on a mouse click of course. If it's only one for example Gornova's suggestion is way easier to implement and doesn't beat you performance wise.
If you have hundreds of entities where you would want to react on a mouse click I would prefer my approach...

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2011 3:15 am 
Offline

Joined: Tue Aug 16, 2011 2:17 am
Posts: 31
Location: Phoenix
I added a bunch of entities to my world using
Tile_Green tile9 = new Tile_Green(x, y, true);
add(tile9);
inside of my Init method. Outside of Init, how do i go about referencing that entity? Say i wanted to do tile9.methodname();
"methodname() being a method in the class Tile_Green"
Doing this now will not work because tile9 is not able to be referenced.


Top
 Profile  
 
 Post subject: Re: MarteEngine
PostPosted: Wed Nov 23, 2011 1:00 am 
Offline

Joined: Mon Mar 21, 2011 4:22 pm
Posts: 32
Location: United States
Has anyone used Nifty gui with Marte engine and have success? I've been trying to get it working for a couple hours but I have failed. I have it able to display and able to click on the buttons etc, but I can't get it to do something when I click on the button.

Example: I click on the Start button it should start the game, but nothing happens. I have no idea what to do. I've tried the following methods in the ScreenController class

Code:
         //tried this method doesn't work.
        @NiftyEventSubscriber(id = "TestButton1")
        public void onTestButton1Clicked(final String id, final ButtonClickedEvent event) {
            System.out.println("test");
        }
        //this is for interactOnClick("testMethod()"); which doesn't work
        public void testMethod() {
            System.out.println("test");
        }


Any help is appreciated.


Top
 Profile  
 
 Post subject: Re: MarteEngine
PostPosted: Wed Nov 23, 2011 8:56 am 
Offline
Slick Zombie

Joined: Wed Apr 02, 2008 1:32 pm
Posts: 1313
Location: Italy
could you give us an example project?

_________________
Blog | Last game Gravity Duck tribute | In progress Gravity Duck tribute


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 170 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11, 12  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group