<Solved>Movement problem

  • So after learning from the absolutely helpful beginner tutorial, I attempted to make a "Feeding Frenzy (fish eat fish)"- like game. The player fish is supposed to grow after eating a few fishes, so in the events sheet, I made each fish equivalent to a score depending on their size, and once the player reaches a certain score, it is supposed to grow. I wanted the fish to grow after reaching a score of 150 in order to eat the medium sized fish, so I did this:

    Condition: System -> Compare variable -> Score = 150

    Action: PlayerFish -> Set size to (142.51, 80.2)

    So I run the layout to see if it works. It worked, however the problem is it automatically faces the right side (which is its non-mirrored version) and it will permanently be facing the right side unless it ate another fish. I added the biggest fish it is supposed to eat, so I made another event in which if the score reaches 1000, the player fish will increase size again to eat the biggest fish. The problem this time is the fish now permanently faces right, and even if it ate a fish, it will still never face the left side.

    Here's the .capx file of the game: (Note: the sprites and background are not mine. I just borrowed from Google images first to see if I will be able to do this kind of game)

  • Hi

    Took a quick look,and I'm not 100% sure why that happens but

    instead of setting the size, try setting the scale.

    I did it and it works.

  • Question one:

    Why are you setting the width to 142 pixels and 51 hundreds of a pixel?

    Question Two:

    Why are you setting the size every tick instead of once?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi

    Took a quick look,and I'm not 100% sure why that happens but

    instead of setting the size, try setting the scale.

    I did it and it works.

    Ok, I'm gonna try doing that, thanks for the suggestion.

  • Question one:

    Why are you setting the width to 142 pixels and 51 hundreds of a pixel?

    Question Two:

    Why are you setting the size every tick instead of once?

    Q1

    Since I need the player fish to grow bigger than the medium fish, in the layout I resized the player fish to be bigger than the medium fish. Then in the properties of the player fish, I copied the new size from there (which is 142.51, 80.2) and pasted it in the actions of the "grow fish" event

    Q2

    I don't remember setting the size every tick. The only events I made involving the condition "every tick" are the "Set text to "Score: &Score" and "Set bullet angle of motion to 180 degrees"

  • I think LittleStain means you should add a trigger once condition

    like this

    some events are triggered once by default. They will have a green arrow (pointing to the right)

    on the very left of the event next to the event number.

    some events are triggered every tick by default. They won't have the arrow.

  • Q1 - Ok, If you like to work with one hundreds of pixels, I prefer integer numbers and I don't think you'd see a difference setting it to 143,80..

    Q2 - I meant this:

    "Condition: System -> Compare variable -> Score = 150

    Action: PlayerFish -> Set size to (142.51, 80.2)"

    This condition will be checked every tick and because it's true every tick when score is higher than 150, the set size action will be performed every tick..

  • LittleStain

    @producermark11

    I just added the "Trigger once" condition to the set size events, and it worked! The fish no longer automatically faces the right side when it grows. Thanks for the tips and suggestions guys, especially for reminding me that some events are triggered every tick. I should keep that in mind now.

  • If you consider this solved hugelarge333

    then it is good practice to say in the Topic Subject

    <Solved>Movement problem

    in this case.

    and yes, you don't need to adjust images to so precise. 400,80 or whatever is good enough

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)