spawn actor in touched area?

tabelortabelor Member Posts: 114
edited November -1 in Working with GS (Mac)
Hi all. What i want to do is very simple. When i touch the screen i want an actor to spawn in the touched area.
Is it posible?

Comments

  • OkyshoOkysho Member Posts: 158
    Sure! This is no problem. What you're going to want to do is create an invisible actor that moves along with your mouse, then whenever it's clicked, spawn your actor.
  • tabelortabelor Member Posts: 114
    i've got a problem with this.
    I've got a ship, and the actor i want to spawn when i touch the screen is a bomb (imagine something like stunt squirrels)
    The problem come's when i move my ship to the right behind the initial screen (480x320 or viceversa). The actor only spawn in the initial screen, when i move out of this first screen (for example to pixel X 500, and i touch the screen, the actor doesn't spawn in the position it were suposed to spawn, but in the initial screen. Is like if were an invisible barrier and the actor could not spawn behind this barreer :S.
    I've checked every actor and behavior, and i've found nothing that can justify this strange behavior.
  • tabelortabelor Member Posts: 114
    My procedure is i create a new actor wich is a black background i will use to spawn my bomb actor. It is 4800 widht and 320 height (like my scene) then i make it transparent and put it in the back of my scene. After this i put behaviors on this actor: when touch is pressed, spawn actor bomb, in front of layer, direction (default), relative to scene, position X (game.touches.touch 1.x) position Y (game.touches.touch1.Y) and relative to scene.
    But i don't know why i get this problem
  • OkyshoOkysho Member Posts: 158
    It's possible that it's because you've put it in the back of your scene, looking at how you've done it, that SHOULD make sense, which is why I'm suggesting the following:

    Try moving your actor to the front of the scene, OR create a dedicated layer for this actor. Yeah it's not fancy, but if it works, it works
  • tabelortabelor Member Posts: 114
    now i have a diferent problem (more or less the same than before)
    no problem with the image spawning, the bomb spawns in it's place but instead of doing his action (to colide with asteroids) it dont does his action :S, or rather it does the action but further back, not were the image spawns, so now i have "an invisible barrier" not for the image of the actor but for his action O_o
Sign In or Register to comment.