Moving an actor in a particular axis - not working?

Karim_SKarim_S United KingdomMember Posts: 19

Hey guys,

So I have an off-screen spawner which I programmed to spawn actors in random directions all over the screen, only I need them to spawn vertically though still at random points in the y axis. I've tried constraining the attribute of the off-screen spawner from self position y to self position y and even changing the attribute on the spawned actor itself but it doesn't seem to work.

Note: I already have the equation set up for spawned actors at random locations within the iphone landscape dimensions.

I'm sure it's a simple fix, any help would be great.

Thanks in advance.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Is your question about the position of the spawned actor or about the movement of the spawned actor? What is it you're trying to do?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Karim_SKarim_S United KingdomMember Posts: 19

    The movement of the spawned actor, seen as they duplicate I'm trying to spawn them along the y axis at random...

  • Karim_SKarim_S United KingdomMember Posts: 19

    Anyone?!?

  • MeepedMeeped Member Posts: 31

    I had a similar issue that I worked out with tatiang. At least I think they're similar. Find the coordinates on the Y axis that you want them to spawn on, and use a random function of the min Y and the max Y you want them to spawn on.

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @Karim_S said:
    only I need them to spawn vertically though still at random points in the y axis.

    Spawn x=whatever you want / y=random(lower value,upper value)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    The movement of the spawned actor, seen as they duplicate I'm trying to spawn them along the y axis at random...

    I'm still unsure of what you're asking. It seems the spawned actor isn't moving the way you want and the spawn location is incorrect?

    Can you post a screenshot of the Spawn Actor behavior and a screenshot of the Move or other behavior in the spawned actor? You'll need to upload them to a file-sharing site and then post the download links here.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Karim_SKarim_S United KingdomMember Posts: 19

    @Meeped said:
    I had a similar issue that I worked out with tatiang. At least I think they're similar. Find the coordinates on the Y axis that you want them to spawn on, and use a random function of the min Y and the max Y you want them to spawn on.

    I already have the coordinates set to the iPhone landscape dimensions, as follows:

    Spawn Actor
    random(0, 568) to random(0, 320)

    I tried adding the random min y and max y both with and without specifying coordinates, yet it didn't work?

  • Karim_SKarim_S United KingdomMember Posts: 19

    @Socks said:

    How would I add this in an equation?
    Please break it down more simply. Furthermore do I need a new attribute for this?

  • Karim_SKarim_S United KingdomMember Posts: 19

    @tatiang said:
    Can you post a screenshot of the Spawn Actor behavior and a screenshot of the Move or other behavior in the spawned actor? You'll need to upload them to a file-sharing site and then post the download links here.

    My game is a shooter, the playable actor is positioned to the far left and the enemies to the far right, I'd like to set a margin for their spawning (approx up to mid-screen) beyond which they cannot spawn so that the player can see them coming as opposed to them just appearing in his face at times.

    I have an off-screen spawner, the rules I set are as follows:

    Timer

    Every 1 second

    Spawn Actor: Enemy
    Place: In front of actor

    In the direction: 0
    Relative to: Actor

    From position: random(0, 568) to random(0, 320) relative to: scene.

    I'm using the windows GS just so you know.

    I'm not too familiar with file sharing, my apologies.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    edited February 2015

    wouldn't you be keeping the x value static? Otherwise they are spawning all over the map?

    Or maybe I am misunderstanding where you want them spawned.

    Based on your code above, the entire screen is a valid spawn point

  • SocksSocks London, UK.Member Posts: 12,822

    @Karim_S said:
    How would I add this in an equation?

    Please break it down more simply. Furthermore do I need a new attribute for this?

  • SocksSocks London, UK.Member Posts: 12,822

    @Karim_S said:
    the rules I set are as follows

    A screenshot is needed to see if there are any mistakes being made.

    @Karim_S said:
    I'm not too familiar with file sharing, my apologies.

    Do you know how to take a screenshot ?

  • Karim_SKarim_S United KingdomMember Posts: 19

    @Socks said:

    I tried this but it doesn't seem to work

  • Karim_SKarim_S United KingdomMember Posts: 19

    @jonmulcahy said:
    wouldn't you be keeping the x value static? Otherwise they are spawning all over the map?

    Or maybe I am misunderstanding where you want them spawned.

    Based on your code above, the entire screen is a valid spawn point

    How do you mean keeping the x value static?

    Yes the whole screen is the current spawn point, however I wish them to spawn from no further than the vertical halfway mark of the screen to allow the player to see the enemies coming rather than them spawning too close.

  • Karim_SKarim_S United KingdomMember Posts: 19

    @Socks said:

    file sharing is the issue, are you saying I can just screenshot and upload directly? If so I'll try get one up.

    Sorry for the delay in responses btw

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @Karim_S said:
    I tried this but it doesn't seem to work

    'It doesn't work' as a piece of feedback is not much use, it could mean anything at all.

    @Karim_S said
    file sharing is the issue

    Try Tinypic.com, it's pretty straightforward to use.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Karim_S said:
    Yes the whole screen is the current spawn point, however I wish them to spawn from no further than the vertical halfway mark of the screen to allow the player to see the enemies coming rather than them spawning too close.

    Then you Want to change your spawn value to random(284,568) instead of (0,568)

  • Karim_SKarim_S United KingdomMember Posts: 19

    @Socks said:

    Sorry, you're right that feedback wasn't helpful.

    So the actors just suddenly started popping up when I tried this, there was no gradual smooth spawning/movement, and it wasn't apparent whether it restricted them to the halfway mark or not.

    I will try jonmulcahy's suggestion and keep posted.

  • Karim_SKarim_S United KingdomMember Posts: 19

    @jonmulcahy said:

    How about the (0, 320) part of the equation, do I change this aswell or leave as is?

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Karim_S said:
    How about the (0, 320) part of the equation, do I change this aswell or leave as is?

    the 0,320 part is allowing your actor to spawn on any pixel from 0 to 320, which is the absolute bottom to the absolute top.

  • Karim_SKarim_S United KingdomMember Posts: 19

    @jonmulcahy said:
    the 0,320 part is allowing your actor to spawn on any pixel from 0 to 320, which is the absolute bottom to the absolute top.

    It worked! Thanks for your help guys

Sign In or Register to comment.