• Content Count

  • Joined

  • Last visited

About moszis

  • Rank
  • Birthday 12/05/1978

Profile Information

  • Gender
  1. I'm having a strange issue, I have not encountered before. When dragging a sprite over another sprite, mouse events underneath dragged sprite are not firing. For example if I have a SpriteA, which has mouseover event. If I simply drag my mouse over it, event would work just fine. However, if i'm dragging another sprite (SpriteB) over SpriteA, mouseover event of SpriteA is not detected. I know I have done this before where it worked, but I cant figure out whats going on right now. Is there some setting that allows a sprite to be "click-through" ? Thank you! Edit: Just in case it makes a difference, some additional information: I am dragging an "item" from one item slot to another. Both item and each slot is a sprite. When dragging an item, I need to know over which slot its currently positioned to know where to move it. Similarly this could be handled on mouseup event, but strangely mouseup event is firing for ORIGINAL slot, not the slot that mouse is hovering over.
  2. Hi Guys, I'm a bit stumped. I dont expect any details, just to be pointed in the right direction. I would like to add a chat box(s) to my game. I would be using node.js and to receive and distribute messages between users. I am not clear on the best approach to create actual chat box where messages would be displayed using pixie framework. Is there a best practice approach for this? Or do I have to use html text box layered on top for the messages? This would be somewhat involved 'chat' with game messages, multiple tabs and coloring/font patterns. Any suggestions would be greatly appreciated! Thank you
  3. By dragable I mean user is able to click on it and drag it. This is why I need to have an anchor at the middle. Thank you for pointing out scale property! Allows me to do the same thing I did with getLocalBounds but in much cleaner way.
  4. Hey mrBRC, Thank you for your response. I did not consider child scaling with parent scaling by default. I have a piece of code that automatically scales the child, so I didn't even notice that it does by default. Its actually very helpful to know as I will clean things up a bit. I solved the issue above by using getLocalBounds() of parent Sprite. Which gives the "unscaled" width/height of sprite image, which for some reason child object needs to appropriately offset the anchor of parent. The calculation is very simple: top left corner of parent = negative (parent.getLocalBounds().width * parent.anchor.x). And same for height. I am still not clear though why child needs the parents "unscaled" size to properly offset. For example if original image size of parent is 500 by 500 but I adjust height/width to display as 100 x 100. I will need to offset the 0.5 anchor by 250x and 250y, instead of 50x and 50y as I originally thought. Even if child size is scaled down by 5x together with parent, it still doesn't change the fact that parent now only has 50 pixels from the center to the edge..
  5. Quick update.. It seems that when sprite is not sized down, everything works as I would expect. Top left corner is simply - (image size * anchor). So it looks like child object coordinates are based on parents original image size and not relative to what is being displayed. I'm pretty sure that i'm doing something wrong, as this is a problem many would have ran in to by now.
  6. I have a sprite with one child text object. Originally, I didn't feel the need to use DisplayObject as all I really need is to display a number at a top left corner of a sprite. When anchor of parent sprite is 0, 0, all is working as intended. Text appears in the top left corner. However, this is a dragable sprite, so during drag I change the anchor of it to 0.5, 0.5(so the mouse appears in the middle). As expected, child text object jumps to the middle of parent sprite. Now, I thought I would simply adjust x,y coordinates or anchor of text object during drag of parent object, but I'm experiencing some very strange behavior. I cant seem to figure out the pattern here. For x,y coordinates of text object I need to use some very strange numbers that are in no way relative to the parent sprite. Also it seems that this arbitrary number changes with the original quality of the image used for sprite, even though this sprite is sized into static width/height during display. Thank you for your help in advance
  7. Perfect! Thank you very much! This also gives me enough understanding of pixie hierarchy to solve several other issues. Very much appreciated!
  8. Hi Guys, Is there a way to specify that sprite should go on top (similar to the way its done in phaser)? I need to have multiple draggable sprites. Currently the last one drawn is always on top. So when you are dragging sprites, they will be dragged under the sprites that have been drawn later. I know it can be easily done by just clearing and redrawing the sprite every tick but it would make it much easier if there was an API to bring it to top layer on mousedown. PS: I know its two dimensional pixel grid(this seems to be common answer to these type of questions).. just talking about APIs here.
  9. Thanks lewster. Ran few tests and it seems like the issue is not with onLoadComplete but with actual image loading in Phaser after initial preload ends, which is why onLoadComplete doesn't fire. After load.image, I added a ridiculously long wait loop, to be sure that loading should be completed. Following tried to add that image as sprite. Sprite shows up as broken image. Also tried to call preload() function again and all the images end up broken.
  10. This might be a really simple question, but I have googled it to death and just cant find the answer.. At random times during game run time I need to load new images and display them as sprites. The way I handled(or attempted) this is by using on node. There is always socket open listening to the server. Message comes in with json object with image information(url, size, name, etc..). I convert that into array of objects and loop through them to load images using game.load.image. So far so good.. The problem is that I dont know how to handle onload event for those images so I can draw sprites. If I just attempt to add sprites, they are simply showing up as broken images. The usual javascript onload doesn't seem to work for game.load.images. I have also seen references to onLoadComplete but that seems to only work for higher level game instance. Thank you for your help!