Series of Questions beginning C2

Discussion and feedback on Construct 2

Post » Wed Sep 07, 2011 12:51 am

Hi there I'm a new user of Construct 2. So far I like it a lot!

I got some problem with my first project. I can't get the "compare two value" condition to work. So I want to check the value during runtime to make sure they are correct. I've searched the forum and internet, a lot of people mentioned you can enter "debug mode" and do this/that. But I can't find any information about how to enter debug mode with Construct 2.

Can someone show me a direction?

Also here's my project, I want to compare the position of mouse.X and player.X and flip the sprite accordingly. No response so far. If someone can show me how "compare two values" work in this situation it would be much appreciated as well!

http://dl.dropbox.com/u/1397194/arrowGameTest.capxnantas2011-09-07 22:46:44
B
18
S
3
G
1
Posts: 4
Reputation: 1,325

Post » Wed Sep 07, 2011 12:56 am

Construct 2 doesn't have a debugger yet - sorry, it's one of our features on the todo list.

When you have multiple conditions in an event, all those conditions must be met for the event to run. If you have two conditions, for example, it reads "Condition 1 and Condition 2 are true: run actions".

So you have an event that reads "Mouse is left of player AND mouse is right of player..." - that can never be true! Separate it in to 2 events and it will work. I'd recommend the beginner's guide to learn the basics of how events work.

Also, I'm afraid HTML5 doesn't let you use negative widths to mirror objects (it's a limitation in browsers). Instead, try enabling 'auto mirror' in the sprite's properties and set its angle between 0 (right) and 180 (left) instead.Ashley2011-09-07 00:56:12
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Sep 07, 2011 11:52 am

Hi Ashley, thanks for the information, I got it work like a charm! That's very fast reply and clear instruction. I love this tool and the support very much!
B
18
S
3
G
1
Posts: 4
Reputation: 1,325

Post » Thu Sep 08, 2011 1:11 am

Hi it's me again. The question I asked in the OP is perfectly answered. But I would like to use this thread to post my other questions from my first project, so anyone can check the latest progress of the project and see the problem solution better. Please tell me if it's appropriate or not.

This time I got stuck on some physics simulation. I would like to shoot arrow and let it move along a parabola. I want to make it simple so let's say the horizontal velocity of an arrow is a constant value. And during its flight the only force in effect is the gravity.

I tried to use Platform behavior at first, to quickly get the movement and gravity going. The gravity works, but I can't apply a initial speed other than towards angle=0. I found it very confusing that the gravity seems to change its direction when the object's angle changes. So I can't fire the arrow with a upwards angle and expect gravity to work towards bottom.

After messing around for a while I decide to drop all movement behaviors and write the movement logic myself. So I added 3 instance variable "Vx", "Vy", "Gravity" and use dt to calculate the position of the arrow for every tick. I won't describe the events in detail here, you can see it easily in the project.

For some reason I can't get the behavior as I want. No matter how I set up the initial velocity Vy and Gravity, the arrow will always flying downwards. Where did I do wrong?

Also at the end of the event sheet I have a group of event handling the angle of the arrow sprite (just sprite rendering, not angle of movement speed). Since C2 uses clockwise angle it's a bit confusing how to correctly apply trigonometric functions. If you could take a look at that part it would be very helpful to me :D

Here's the download link of the project again:
arrowTestGame

Thanks a lot!


============================================
EDIT: After I posted this I found the thread discussing about gravity:
http://www.scirra.com/forum/general-gravity_topic44414_page1.html

And the example posted in this thread is very helpful. I soon realized that I messed up C2 x,y coordinate with math x,y coordinates. I did all my math assuming y is increasing when moving upwards! So stupid...

After that sorted out. My script works finally!

Again all the problem I got so far is due to my lack of knowledge and C2 is very well designed!

Here's the project file that has the correct coordinate setup. If someone has similar question, you can compare the two to see what's wrong.

Working Project Filenantas2011-09-08 01:50:07
B
18
S
3
G
1
Posts: 4
Reputation: 1,325


Return to Construct 2 General

Who is online

Users browsing this forum: Aphrodite, Eisenhans, R0J0hound and 13 guests