TwinBlazar's Recent Forum Activity

  • Actually, "on created" event will run for all objects on startup as well. Because when the layout is loaded, these objects are created on the layout immediately.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is the capx: http://www.mediafire.com/download/r5dbckk56xjccb6/gravityExample.capx

    Inside the capx contains these objects:

    The black solid floor/ceiling are the same object.

    The stickman is the player, having Platformer behavior.

    The arrows are just 2 different sprites for Gravity Up and Gravity Down.

    Now, in event sheet:

    When player collides with Gravity Up arrow, he will be flipped and his angle of gravity will be set to -90, causing him to have reverse gravity. The same applies for the Gravity Down, but it sets him back to original gravity.

    Angle of Gravity is one of the attributes in events of Platformer behavior. Only objects with Platformer behavior will have this Angle of Gravity listed.

    Try run the capx.

    Are you ok now?

  • You can create a placeholder Gravity setter object (and set it invisible). This object could be an ordinary Sprite. In Event Sheet, when your player or enemy collides with it, you change "angle of gravity" of your platform behavior.

    If you need more help, just say so.

  • I think you are only disabling collision on all objects on startup. But for new objects, when created, do not have collision disabled. You have to disable them via "on create" event.

  • Yikes, I just read my post again. If it's not helpful to you, as in you have hard time interpreting my text, feel free to ask. I will try to tone down my wording and try to put myself into your shoe more.

    But do you understand what I am saying above?

  • This wont cause any problem.

  • Simcity... this could be very difficult.

    You have to play around with tilemaps. https://www.scirra.com/manual/172/tilemap

    Imagine left click set a tile to a road tile.

    What if a road has intersection, does it have to be set to a T-shaped intersection or + shaped intersection? You need events to take care of all these.

    For people going from one place to another, they must be able to know their shortest path. There is pathfinding feature in C2: https://www.scirra.com/manual/154/pathfinding

    But before I overwhelm you further, could you please try create a simple program first where:

    1. There is a road with several intersections.

    2. A person walks from point A to point B on the road.

    Try do the above first before proceeding any further. If you need help on specific features, create new topics for those.

  • You can use variable like this:

    For each sprite,

    • if instance variable A is 0, set instance variable A to 1 and execute some codes further.

    This will make the code above executed once for each instance when its instance variable is 0. Set instance variable to 0 again somewhere for a particular instance to have the event run this part again for that particular instance.

    Don't use "trigger once". If my memory is correct, it is not applicable in for each loop.

    Actually... can you tell us your big picture? What are you trying to do?

    not sure whether this will help you.

  • How about use "Compare X" in "for each" instead of comparing the variable "whichSide"?

    For example,

    Press Left

    • For each,
    • - if x < 400 : Sprite.x = Sprite.x -120
    • - else : Sprite.x = Sprite.x +120

    You have to place something like Solid objects in the middle to prevent the sprite to go to the other side. (otherwise, with this method, you might have a bug that both sprites move together on one side.

    Logically, it is acceptable...

    OR actually, a simpler method would be:

    create 2 sprites with exactly same animation, etc., but name them differently, maybe player_LeftSide and player_rightSide.

    Now, in your events:

    Press Left:

    • player_LeftSide.x = player_LeftSide.x - 100*dt
    • player_RightSide.x = player_RightSide.x + 100*dt

    Press Right:

    • player_LeftSide.x = player_LeftSide.x + 100*dt
    • player_RightSide.x = player_RightSide.x - 100*dt

    This will allow you to make do without using "For Each". However, this event design may make you doing things for the player twice.

    Is this ok for you?

  • First of all, you need to have an instance variable (let's call it "whichSide") to keep track of which side of the sprite would take. In one of the two sprites, set this variable to be non-zero. Under your control input, you will have "For Each" event for addressing each sprite individually, and check each sprite's whichSide variable, and proceed with the movement accordingly.

    Here is an example:

    Pressing left will move sprite that has whichSide value of 0 to the left, and the other with non-zero value to the right. Pressing right will be the opposite of the above.

  • All right. This is what you have to do basically:

    http://www.mediafire.com/view/6eb3f48e5 ... Friend.JPG

    Inside For Each, put those events related to your object in. This will cause all objects to be individually addressed. Be careful on performance though. If you have many of these For Each events and many objects checked with For Each events, your game could be slow to a crawl. Be careful.

    But before taking this for granted, please create an empty project to play around with events with and without For Each. Perhaps this could give you some more idea.

  • Can you post in English? I am not sure whether Google can interpret languages correctly or not.

TwinBlazar's avatar

TwinBlazar

Member since 14 Apr, 2013

Twitter
TwinBlazar has 1 followers

Connect with TwinBlazar

Trophy Case

  • 11-Year Club

Progress

11/44
How to earn trophies