Jump to content

Matt_UK

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Matt_UK

  1. this was me doing it wrong....

    I didnt understand the charactermaps example code properly (and probably I still don`t)

    i used:

     
    public boolean touchDown (int screenX, int screenY, int pointer, int button) {
    
    if(button != Input.Buttons.RIGHT)
    
    player.characterMaps[i] = charMaps[i]; //set the character map to the one saved in maps 
      else   player.characterMaps = null; //set the char map to null, to remove it   i = (player.characterMaps.length+(++i))%player.characterMaps.length;   return false;  
    
    }
    
     

     

    but when i changed it to 

      player.characterMaps[0] = charMaps[i]; //set the character map to the one saved in maps

     

    everything worked as planned.

     

    I then spent a day with a working character map demo and being unable to get the Spriter Player to render within my game logic.

    turns out I didn`t understand Camera classes properly either so now that`s fixed i seem to be able to completely get rid of spritesheets in my game and the world is a wonderful place again :)

     

                             

     

  2. On 11/11/2014 at 11:18 PM, jraselin said:

    I've done some patch to fix these bugs

    Character map with "hidden" object => the objects are still drawed

    inside SCMLReader

     

     
    
    protected void loadCharacterMaps(ArrayList maps, Entity entity) {
    		for (int i = 0; i < maps.size(); i++) {
    			Element map = maps.get(i);
    			Entity.CharacterMap charMap = new Entity.CharacterMap(map.getInt("id"), map.getAttribute("name", "charMap"
    					+ i));
    			entity.addCharacterMap(charMap);
    			ArrayList mappings = map.getChildrenByName("map");
    			for (Element mapping : mappings) {
    				int folder = mapping.getInt("folder");
    				int file = mapping.getInt("file");
    				if (mapping.get("target_folder", null) == null) {
    					charMap.put(new FileReference(folder, file), null);
    				} else {
    					charMap.put(new FileReference(folder, file), new FileReference(mapping.getInt("target_folder"),
    							mapping.getInt("target_file")));
    				}
    			}
    		}
    	}
    

     

    and the Drawer

     

     
    
    public void draw(Iterator it, CharacterMap[] maps) {
    		while (it.hasNext()) {
    			Timeline.Key.Object object = it.next();
    			if (object.ref.hasFile()) {
    				// apply map
    				if (maps != null) {
    					for (CharacterMap map : maps) {
    						// key exists
    						if (map != null && map.containsKey(object.ref)) {
    							// draw if not "hidden" 
    							if (map.get(object.ref) != null) {
    								object.ref.set(map.get(object.ref));
    								this.draw(object);
    							}
    							break;
    						} else {
    							this.draw(object);
    						}
    					}
    				} else {
    					this.draw(object);
    				}
    
    			}
    		}
    	}
    

    Hi....

    this seems to be a good partial fix...

    it now recognises "hidden" sprites on the first character map but not on any others 

    or am I doing something wrong?

     

     

×
×
  • Create New...