<Solved>Movement problem

Just started using Construct 2? Post your questions here

Post » Fri May 29, 2015 3:06 am

Message: hugelarge333 is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
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)
Last edited by hugelarge333 on Fri May 29, 2015 3:58 pm, edited 1 time in total.
B
5
Posts: 5
Reputation: 247

Post » Fri May 29, 2015 9:10 am

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.
Last edited by producermark11 on Fri May 29, 2015 9:24 am, edited 1 time in total.
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri May 29, 2015 9:19 am

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 29, 2015 11:56 am

producermark11 wrote: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.
B
5
Posts: 5
Reputation: 247

Post » Fri May 29, 2015 12:04 pm

LittleStain wrote: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"
B
5
Posts: 5
Reputation: 247

Post » Fri May 29, 2015 12:28 pm

I think LittleStain means you should add a trigger once condition
like this
Image

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.
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri May 29, 2015 12:34 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri May 29, 2015 1:14 pm

@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. :)
B
5
Posts: 5
Reputation: 247

Post » Fri May 29, 2015 2:42 pm

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
B
36
S
10
G
4
Posts: 250
Reputation: 7,963


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest