Want AI, Gestures, 3D, Inventory, or Menus???

  try{ getFittingBoard(new Topic()); }
catch (Exception e) { postHere() };

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby OzLark » Sun Apr 01, 2012 1:34 am

Hi Mathew,

You lost me here.

Mathew wrote:Okay, it looks and sounds much better, at least for me, but I'm wondering about one thing, every new level icon texture region needs to be cloned using clone() or deepCopy() in newer version of andengine (otherwise as we know, every level icon will have the same look)

Which means, if lets say my game has 120 levels, I have to create 120 level icons and clone texture 120 times, which means in this way of handling it I need 120 texture regions in compare to 4 texture regions while using first mentioned way.


I don't understand why you need to clone textures - I don't think I understand what you are doing, I thought I understood until I read that paragraph...
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby Mathew » Sun Apr 01, 2012 12:56 pm

Since every level icon might represent more than one state, it means I have to clone/deepCopy texture region for every level icon, otherwise if I would use the same texture region for every icon, if I would change lets say current tile frame index of first level icon, every level icon would change as well.

Image

Thanks for answer.
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby IFL » Mon Apr 02, 2012 2:32 am

I have a solution, but not the time tonight to explain in detail. Basically, have a class that contains all three stars as individual sprites and only show the number of stars that you need. That's 1 texture region and just several instances of the class that extends entity... Sorry that my explanation is so rushed, but I'll elaborate tomorrow if you need.
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby OzLark » Mon Apr 02, 2012 2:57 am

Sorry Mathew, I'm still a bit confused, but I think you have more experience with AE then I do, so I don't want to presume that you're doing something wrong, but I've never experienced a scenario where I need to clone a texture region - perhaps I'm doing things in an odd way, or you are using GLES1 and I only have experience with GLES2 (and perhaps there is a difference between them?)

But anyway, to build a screen like you show I have

  • 1 * background [1 texture region]
  • 1 * level icon (no stars) [1 texture region]
  • 1 * locked level icon [1 texture region]
  • 1 * star icon [1 texture region]
Then in code I create a sprite for each level icon and to each level icon sprite I attach a sprite for each star needed - no texture cloning etc. I fully understand that this may not be uber high performance, but that isn't typically required for a level selection screen, I certainly don't notice any performance issues with this approach.
Did this post help you? Feel free to return the gesture by downloading Ninja Bees, creating a level (or more) and sharing it to the Ninja Bees website!

Ninja Bees - Our latest Android game, check it out on Google Play (free) or paid with no ads
OzLark
 
Posts: 1130
Joined: Sun Feb 05, 2012 3:19 am

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby Mathew » Mon Apr 02, 2012 12:14 pm

Thanks for answers, yes I thought about such way, but I wanted to reduce amount of sprites.

I have a solution, but not the time tonight to explain in detail. Basically, have a class that contains all three stars as individual sprites and only show the number of stars that you need. That's 1 texture region and just several instances of the class that extends entity... Sorry that my explanation is so rushed, but I'll elaborate tomorrow if you need.


Thanks, I would appreciate.
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby IFL » Mon Apr 02, 2012 4:36 pm

Mathew wrote:Thanks for answers, yes I thought about such way, but I wanted to reduce amount of sprites.

I have a solution, but not the time tonight to explain in detail. Basically, have a class that contains all three stars as individual sprites and only show the number of stars that you need. That's 1 texture region and just several instances of the class that extends entity... Sorry that my explanation is so rushed, but I'll elaborate tomorrow if you need.

Thanks, I would appreciate.

Something like this... (this is GLES2, but the concept is applicable for GLES1)
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package ifl.games.runtime.Elements;
  2.  
  3. import org.andengine.engine.Engine;
  4. import org.andengine.entity.Entity;
  5. import org.andengine.entity.sprite.Sprite;
  6. import org.andengine.opengl.texture.region.ITextureRegion;
  7.  
  8. public class StarsEnt extends Entity
  9. {
  10.         private final Sprite[] StarSprite;
  11.         public StarsEnt(final float pX, final float pY, final float pWidth, final int pNumStars, final ITextureRegion pTR, final Engine pEngine)
  12.         {
  13.                 StarSprite = new Sprite[pNumStars];
  14.                 final float CenterCollectionAdjustment = (pWidth - (pNumStars * pTR.getWidth()))/2f;
  15.                 for(int i = 0; i<StarSprite.length; i++)
  16.                 {
  17.                         StarSprite[i] = new Sprite(i*pTR.getWidth()+CenterCollectionAdjustment, 0f, pTR, pEngine.getVertexBufferObjectManager());
  18.                         this.attachChild(StarSprite[i]);
  19.                 }
  20.                 this.setPosition(pX, pY);
  21.         }
  22. }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby Mathew » Tue Apr 03, 2012 11:29 pm

Thanks IFL, will be helpful ;)
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby IFL » Fri Apr 06, 2012 10:55 pm

Got some character graphics done... Nothing special, but it's a lot considering how much time I've had to work on it...
ST_MaB.gif
ST_MaB.gif (70.31 KiB) Viewed 634 times

I also have a new AI dialog system, new player controls, and tons of little optimizations finished. If anyone knows about Valve's database-dialog system, I'm using that. That kind of system is awesome and should probably be a part of every game that has a story. If you're interested in it, search google for "Valve Publications dialog" or something like that. They have a PDF of a presentation covering their system.
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby Niffy » Sat Apr 07, 2012 1:14 am

:-o
tiledEd.png
tiledEd.png (202.31 KiB) Viewed 627 times


:roll:
isoPartlyWorking.png
isoPartlyWorking.png (64.22 KiB) Viewed 627 times


And its TMX!!!

I'm getting somewhere, just need to tweak it so placements are correct, as you may already guess its not quite correct
implement getTileAt
implement objects group
collision

See you in 5 years time!
Niffy
 
Posts: 284
Joined: Sat Sep 17, 2011 8:39 pm

Re: Want AI, Gestures, 3D, Inventory, or Menus???

Postby Mathew » Sat Apr 07, 2012 12:09 pm

See you in 5 years time!


Looks promising, haha :)
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

PreviousNext

Return to OFF-Topic

Who is online

Users browsing this forum: No registered users and 3 guests