littanana's Forum Posts

  • I think the outline effect does the same (moving into 8 directions to create the outline). So it might still be slow, but at least it is easier on your code.

    Ah right I forgot to mention. I found that with google. And anyway the last pages were just comments on it not being working (like some said it works in preview but not in export) so I assume the creator abandoned the code? I downloaded it and it just gave me an error when I tried to start C2 so it doesn't work.

  • I did this... I manually create new sprites for the player and position them around the player with few pixels offset to all the eight directions. Set the mirror and frame to same than the host. Yeah.

    Problems:

    1) It works but I'm extremely worried if any game can run this if I'm creating outlines for my player, maybe max 15 enemies at once and also items that drop from dead enemies and some possible item pickups... So think anything from 1 to 20 sprites at once having 8 copies. Is that much?

    2) Also I want to know if there is any easier way to achieve this and, how to I create this all for all my other sprites easily.

    Thanks for reading!

  • you could also look at using lerp.

    so if you had an instance variable called ivHealth

    healthbar set width to lerp(self.width,self.ivHealth,0.01)

    Hey, I'm currently using event:

    healthbar set width to "(HP/maxHP)*barMaxHP.Width"

    With my healthbar being a sprite that places itself on another sprite which is the maxHP.

    How do I combine this code with the Lerp thingy? I can't figure it out since I don't really understand perfectly what lerp does.

  • Thanks!

  • I have an ai following me and another ai following the first ai. I want them to sort themself properly so it doesn't look like the one in the front is under the one at the back.

    I tried to do this but I just can't get it to work even though the event should be right following the advice that was given in this thread?

    link:

    https://www.scirra.com/forum/z-order-equals-to-y-position_t85622[/code:1df5mcm1]
    
    my code:
    [img="http://i.imgur.com/r8mHcTv.png"]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • .. actually i just got it to work and came back to post the .capx lol

    https://drive.google.com/file/d/0Bw7sth_-pQTXZWtIbTN0dWtRRVU/view?usp=sharing[/code:3es20waq]
    
    Thanks either way! I'm gonna check that out and see which code is better!
  • I'm going to have the game consist of multiple layouts that together make up the game map.

    I know how to move from layer to layer, whoever how can i create something like this;

    • when i'm in layout 1 and i move to layout 2 i want to be on the left side of layout 2 (because that is the direction i came from)
    • now if i move to layout 3 i want to be on the left side of layout 3 again.
    • now if i move back to layout 2 i want to be on the right side of the map.

    I tried to recreate it with a global variable that remembers which side i existed in last time but i think the code that changes the layout runs and doesn't do any other code..? I also use the same event sheet for every layour if that makes any difference.

    So any help?

  • Thank you so much!

  • blackhornettechnologies.com/Construct2Stuff/helpmepickuponlyone_BHT.capx

    Keep track of the current item's UID, so you can exclude it, as needed.

    Can you explain the code? I'm glad to see it work, but I want to be able to learn it so maybe next time I can do something similar myself.

    How does this code work if I had two different object types at the same time when I'm trying to pick up something?

    Also, how can I add onto this an make a system to have a "carrying something" state for the player. I'm hoping to add custom animations and custom movements (mainly just slower, and weaker jump)

  • So yeah I want to be able to only carry one item at once.

    I want it that when I press z it will drop an item if its carrying something. Only after that if I press Z it will pick up an item.

    Also I want to be be able to have a different set of animation when carrying the item. And less jump power.

    https://drive.google.com/file/d/0B6czatIgBi7lT2luUEN0dnpYSXc/view?usp=sharing[/code:2vwz43zh]
  • I would also like to know how to modify the code to work with multiple instances of the same sprite. I want to pick up an item and put it down. Only one item can be carried at once.

  • Why is the animation not working when pushing up-arrow?

    - Because pushing the up arrow makes the player jump and when jumping you want the jump animation to play, so the program is told to play two animations at the same time, which is impossible..

    Why is the animation playing when not moving?

    - Because your event states to play the animation while overlapping and that condition is true..

    First thing you should probably do is remove the default controls from you behaviour and add your own in events..

    Also you seem to not understand the difference between triggered events and normal events..

    Adding a "system every tick" condition to a triggered event is useless..

    Your event 23 only changes the angle "on collision" so when no collision is registered the player angle will not change to platform angle..

    So I changed my code in the following way;

    • I added to my other animations to activate when I'm not using the ladder so now the animations don't overlap.
    • I changed the angle detection to "every tick" and "is overlapping solid at offset (0,5)"

    I will keep the default controls for now but if I run into problems I will re do them. Thank you so much for this reply. I learned a lot!

  • When using the ladder the animations play all weird. When moving down and not moving the animation does play but when moving up it doesn't play.

    I need it to not play when not moving and play when I'm moving up and down.

    Also bonus problem; Even thought I have every tick change player angle to platform angle, why does this happen?

    .capx for my file

    https://drive.google.com/file/d/0Bw7sth_-pQTXSGtUdGZiT0d2MGM/view?usp=sharing[/code:thb6bl3x]
    edit: i changed the link
  • > No I don't because the code says "choose(0,90,180,270)" or a variation of that and it always changes depending of the position of sprite, like for example if i have walls in the north and south the code does "choose(0,180)"

    >

    > And I have a code for every single possible combination in between a wall at every side, and a wall and no side.

    >

    Well after the choose() expression the direction is chosen right?

    So that direction should determine the animation..

    Maybe to make it easier on yourself, you could set an instance variable on the sprite to the choose() and use that instance variable for setting the animation..

    Another way, if this choose sets the bullet direction, you might also be able to add a condition

    for each sprite

    system compare two values: sprite.bullet.angleofmovement = 180

    > set animation

    Heh, actually I just finished doing that changing the choose() to pick a variable and came back to the thread to see it recommended, and yes it works much better now.

  • No I don't because the code says "choose(0,90,180,270)" or a variation of that and it always changes depending of the position of sprite, like for example if i have walls in the north and south the code does "choose(0,180)"

    And I have a code for every single possible combination in between a wall at every side, and a wall and no side.