GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Spawning edges work with vertical elevators but not on horizontal? Pictures included for better help

Hello,

Im doing some testing for a test game and want to be able to spawn edges on all type of platforms so the player cannot jump while colliding with the edge.

So the edge / jump function works. The edge spawns correctly on the platforms standing still including the platform moving up/down. And it follows the vertical platform with constrain Y position.

BUT when I spawn the actors "Horizontal Edge" to the platform moving left / right the edge spawns in the middle of the elevator actor?

Why is that when I use the same code on all platforms. It spawns great on all platforms exept this pink left/right moving elevator :/

Check pictures.


«1

Comments

  • KIIVIINKIIVIIN Posts: 159Member

    One more quick question about the EDGES of the playing screen. Why does it show like a frame of small dots? Check around the whole "game area" next to the gray frame.

    Thank you in advance

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

    I would make sure your spawned actor is not unlocked (double-click it on the scene to check) and therefore has instance rules different from the prototype.

    Your position expressions look correct although you could simplify them to self.Size.Width/2 and -self.Size.Width/2.

    Add a log debugging statement to the elevator edge actor with the expression self.Position.Y. Does the statement appear in the Debugger window? If so, what is the Y position relative to the center of the platform actor

    Also try creating a blank new scene and adding the platform and spawner actor (perhaps the platform IS the spawner actor which is fine) and test it again. Does it work on this new scene?

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    I would make sure your spawned actor is not unlocked (double-click it on the scene to check) and therefore has instance rules different from the prototype.

    Your position expressions look correct although you could simplify them to self.Size.Width/2 and -self.Size.Width/2.

    Add a log debugging statement to the elevator edge actor with the expression self.Position.Y. Does the statement appear in the Debugger window? If so, what is the Y position relative to the center of the platform actor

    Also try creating a blank new scene and adding the platform and spawner actor (perhaps the platform IS the spawner actor which is fine) and test it again. Does it work on this new scene?

    I changed the self.size.Width/2 thing so its more simple in the coding (thanks for that)
    Well the horizontal elevator spawns the edges and the edges follow the Y position as it should. Problem is that the Edges spawn in the middle of the elevator when they should spawn at the "edges" of the platform hElevator.

    I cannot find why that is when all other platforms is correct with the spawning.

  • KIIVIINKIIVIIN Posts: 159Member

    Same is that the new scene as you asked for!

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

    What did the log debugging statement show? That will help determine the starting point of the spawned edge actors.

    Also, if you turn off all of the rules & behaviors in the edge actor, does it still appear in the center of the horizontal elevator actor? I'm wondering if you have a behavior there that is re-positioning the edges.

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    What did the log debugging statement show? That will help determine the starting point of the spawned edge actors.

    Also, if you turn off all of the rules & behaviors in the edge actor, does it still appear in the center of the horizontal elevator actor? I'm wondering if you have a behavior there that is re-positioning the edges.

    If I have the debuglog on the actor "edge" spawns where the platform is set on x position.

    Log(Actor: hElevatorEdge): 0
    Log(Actor: hElevatorEdge): 0
    Log(Actor: hElevatorEdge): 972.575 --- is where the platform is set on x position.
    Log(Actor: hElevatorEdge): 972.575

    If I turn of the constrain attribute selfpositionX to game.hElevatorX.position in the edge then the edge spawns at the left side and in the middle :sweat:

    Log(Actor: hElevatorEdge): 0
    Log(Actor: hElevatorEdge): 0
    Log(Actor: hElevatorEdge): 1003.2958333333
    Log(Actor: hElevatorEdge): 1003.2958333333

  • KIIVIINKIIVIIN Posts: 159Member

    Isnt their an easier way to make the player "unjumpable" when he touches the edge of an platform? I mean set it so if the players "10 first pixels" on the x sides makes jump false?

    Or do I need to set edges all around every platform?

    (This is just an offtopic question)

  • KIIVIINKIIVIIN Posts: 159Member

  • KIIVIINKIIVIIN Posts: 159Member
    edited January 2016

  • KIIVIINKIIVIIN Posts: 159Member

  • KIIVIINKIIVIIN Posts: 159Member

    bump

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang - You still active? Been trying everyting now wont work :sweat:

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

    The problem is that you are constraining the edge's X position to the elevator's X position. It needs to have an offset (± self.Size.Width).

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    The problem is that you are constraining the edge's X position to the elevator's X position. It needs to have an offset (± self.Size.Width).

    I dont understand what you mean :(
    At the moment I only got this set up on the H elevator

    This is the result in game.

    Can you please explain it little more what you ment?

    regards

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    The problem is that you are constraining the edge's X position to the elevator's X position. It needs to have an offset (± self.Size.Width).

    Oh wow.. GS is so bugged. I got exact same coding but I cleared all the rules and set them again by the picture I posted here... Now they end up in each end... Why is that happening.. Wow.

    Well with the offset thing I know what to do now,.. Stupid GS keept the old coding so it bugged from behind without me seeing it live..

    I have same coding as the pictures at the moment and all is correct, why is that???

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    The problem is that you are constraining the edge's X position to the elevator's X position. It needs to have an offset (± self.Size.Width).

    I managed to get them on each side.. But I cannot figure out how to make them follow the platform right and left.. tried with all my knowladge and its bad that I cannot figure it out :( please help!

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    See my video on scene linking actors that should point you to a solution. Don't be so hard on yourself. You are just learning GS and what your doing is advanced stuff. It takes time to learn all the aspects.

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

    What I was referring to is that actors' positions are determined by their center coordinates. So if you constrain the self.Position.X of one actor to the self.Position.X of another actor, you are aligning their centers. For something like platform (or "elevator") edges, you'll want to constrain the edge actors to the x position of the elevator actor plus (or minus) half the width of the elevator actor.

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    What I was referring to is that actors' positions are determined by their center coordinates. So if you constrain the self.Position.X of one actor to the self.Position.X of another actor, you are aligning their centers. For something like platform (or "elevator") edges, you'll want to constrain the edge actors to the x position of the elevator actor plus (or minus) half the width of the elevator actor.

    Well so far I did figure it out by myself about the center point etc.
    I did 2 different actors (left edge , Right Edge) and hooked them to the platform moving horizontal. All fine now finally thank you.

    Issue was that I tried to use only 2 actor for 2 spawns of edges so if I set the correct x position both went the same place.

  • ApprowApprow Posts: 703Member

    I'm not sure if I got the issue correctly, but when you're working with the same actors in one scene, its usually a good idea to give them a self.ID attribute. This way they cant mess with each others rules.

    For example:
    if self.ID = 1 - spawn edge to ...
    if self.ID = 2 - spawn edge to ...

    If you do it like this you don't need to unlock the actors rules panel, you only need to change the self.ID attribute manually for each actor placed in the scene.

  • KIIVIINKIIVIIN Posts: 159Member

    @Approw said:
    I'm not sure if I got the issue correctly, but when you're working with the same actors in one scene, its usually a good idea to give them a self.ID attribute. This way they cant mess with each others rules.

    For example:
    if self.ID = 1 - spawn edge to ...
    if self.ID = 2 - spawn edge to ...

    If you do it like this you don't need to unlock the actors rules panel, you only need to change the self.ID attribute manually for each actor placed in the scene.

    The issue was that I used 1 actor "edge" and spawned it with the platform Helevator on the self.width/2 and -self.width/2. That will say at the platforms sides.

    That worked fine but when I used the constrain attribute on the EDGE actor they both ended up in the middle of the platform. I wanted them to be on the sides, I didnt find a way so I made 2 actors "edgeRight" & "edgeLeft" and spawned them the same way, then later I made them attached with the size of the platform /2.

    I dont know how to make it work with one actor on 2 different sides with 1 constrain attribute to the X.

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

    I would use two actors for the edges. There is a way to do it using a single actor but it's complicated.

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    I would use two actors for the edges. There is a way to do it using a single actor but it's complicated.

    Yes, thats how I managed it haha.
    Well thank you for the help!

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

    Here's a demo of what I was talking about regarding a single edge actor.

    You can "pass" a game attribute value from a spawner actor to spawned actors by changing the value just before spawning and having the spawned actor change a self attribute to that same value in order to store it. The spawned actor can then use that stored value in a rule condition.

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    Here's a demo of what I was talking about regarding a single edge actor.

    You can "pass" a game attribute value from a spawner actor to spawned actors by changing the value just before spawning and having the spawned actor change a self attribute to that same value in order to store it. The spawned actor can then use that stored value in a rule condition.

    But this does not make the platforms size changable? I mean , I want to be able to change the size on the screen of the platform so the edges follow the size I set it too. Lets say I have 2 platforms with 2 different width set manually on scene. Now they only follow 1 width, or Im I wrong?

  • tatiangtatiang Posts: 11,845Member, Sous Chef, PRO, Senior Sous-Chef
    edited January 2016

    You can have the platform be any size you want to begin with but if you have different sized platforms then you need to use multiple attributes or a table to store the widths and X positions and you have to "tie" (sync) those values to a particular platform. Again, certainly doable bit complicated.

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

  • KIIVIINKIIVIIN Posts: 159Member
    edited January 2016

    @tatiang said:
    You can have the platform be any size you want to begin with but if you have different sized platforms then you need to use multiple attributes or a table to store the widths and X positions and you have to "tie" (sync) those values to a particular platform. Again, certainly doable bit complicated.

    By the way, Could you explane another thing with these edges.
    On my vertical elevator the edges skips a pixel when going up / down.

    Check picture. Its like they move one pixel down when they elevator move up and when the elevator go down they move de opposit way. Like there is some kind of wind recistance :open_mouth:

    Picture is when the elevator is on the way up. You can see that the top of the edge is missing like 1 pixel.

    3.PNG 7.7K
  • tatiangtatiang Posts: 11,845Member, Sous Chef, PRO, Senior Sous-Chef

    I'm not sure why that would be happening. I adjusted my demo (see attached) to make the platforms move vertically and I'm not seeing that issue. How are you constraining the edges? And how are you moving the platforms?

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

  • KIIVIINKIIVIIN Posts: 159Member

    @tatiang said:
    I'm not sure why that would be happening. I adjusted my demo (see attached) to make the platforms move vertically and I'm not seeing that issue. How are you constraining the edges? And how are you moving the platforms?

    It is moving by self.Max & self.Min attributes.
    So I set what the max Y position is then minimum y position. Its from the gamesalad tutorial with platform games. Then I spawn the edge actor half the size etc as we talked about before.

    Then in the EDGE actor I constrain selfposition y to the game attribute Y taken from the Vertical platforms position. Edges move up and down but skips like 1 pixel as said before

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member

    Are you using real attributes to store the values?

Sign In or Register to comment.