lionz's Forum Posts

  • I would do it with a global variable, you can set it to 0 or 1 depending on who you are playing as. Then your events for movement and such can have conditions like var=0 and var=1. In a basic sense you could set the variable to 1 when you collide with the water, and back to 0 when you are not overlapping the water.

  • On health 0 : player set position to x,y

  • I tried it, but it still doesn't work. Here's what all my events for the healtbar look like:

    Event: Player: on collision with enemy

    Subevent: Healthbar: Animation frame<4 Action: Healthbar:set animation frame to Healthbar.Animationframe+1 Action: System: subtract 1 from Health

    Event: System: Health = 0 Action: Restart layout.

    I don't know if you'll be able to understand that or not. And the Health thing is my global variable. Thanks.

    Let's say you have 5 frames and 5 health, the basics would be to set animation frame to health, because they are same frame 5 is full health (5) for example.

    If it's more a percentage or other values, you create events to set animation frame based on the amount of health you have. On collision with enemy you can subtract from health, but you don't need to put the animation health bar events also in there, they should be separated out so it's easy to understand, for example if health > 80 then set health bar animation frame to 5.

  • Ok if this is just about the lag, you already created a duplicate post so we can leave this one.

  • Not really got the time, what did you try so far ? how does the game work ?

  • The thing is, I have a healthbar where it has four animations of it getting smaller, if you can understand that. I have never actually been able to figure out how to do the healthbar at all, so if you have any ideas, I would appreciate them.

    You can set the animation frame based on health value using events

  • So did you actually have any problem with calculating distance ? because it sounds like you are saying the problem is lag? This makes the post confusing.

    If it lags all the time then it could be any of your events, or it could the graphic memory usage so maybe check this. In general though I'm surprised you added 40,000 objects to the screen as this seems like a poor game-making strategy in any engine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't as the private messaging feature was removed some years ago but you can leave something like discord name in your post and they can contact you.

  • If you restart the layout when health is 0 then player should be back in its initial position unless you set the player to global. I'm not sure about the under/over platforms in 3D but maybe you are touching the collision box so you need to make either the platform or player collision box smaller, or it could be something more complex being that its 3D I don't know I can't see the game and am only guessing with this.

  • If you have checkpoint objects, it could have a variable ID where you number them. Using a global variable that tracks the checkpoint number you are at, by setting the global variable value to the ID of the checkpoint when you reach it, if you respawn you choose the checkpoint object where its ID is equal to the global variable value and then set the player position.

    Another option is to save the game when you hit a checkpoint then change its status so you can't save again, then when you die you just load the game, depending on if save games is the approach you want to take.

  • If it lags every time you click the mouse for that event then I guess it's from checking the LOS of 40,000 sprites.

  • Ok and the answer to the other bit ?

  • I don't see any logic related to calculating distance. What is cut off at the top, is that a group ?

  • So that is what I mentioned above, you are out of scope so the variable is reset. So you've now put the logic within the same event yes this should fix it.

  • lionz

    I don't have any other events that control opacity. Here's what I have for the collision event.

    And for the opposite to set it back to 100 ?

    Can you explain the gameplay of the game and what the border is ? Maybe there is a better way to achieve what you want.