Reading off from a large .txt file

Get help using Construct 2

Post » Sun Mar 31, 2013 12:27 am

Hi, I'm currently making a rythm game with mechanics similar to Stepmania and DDR. I want construct to be able to load a .txt file, read it line by line, and execute commands based on the last 4 digit number it analyzed.

I have uploaded the .txt file to the "files" folder, but I'm having a hard time getting ajax or xml to access it. Would someone kindly explain to me how to access a text doucument in the "files" folder?

Also, does anyone have any advice on how to once per tick make Construct scroll one line down in this .txt file, and output the value of the 4-digit number it just analyzed?

If I nail this I got all the core mechanics down for my game project. Any help would be very appreaciated!

-TinimationsTinimations2013-03-31 00:28:23
B
22
S
7
Posts: 316
Reputation: 2,490

Post » Sun Mar 31, 2013 3:04 am

Here's an example of both loading a project file via Ajax, and displaying 1 line of it at a time. I load the file's data into an instance variable, but it could be loaded into an array, or other type of object depending on your objective.

Annotated Capx

Also, if you're making a timing based game, I recommend you don't base the timing on the game's frame rate as it can vary. You're better off using a "Ever X seconds" condition rather than "Every Tick".
B
44
S
13
G
7
Posts: 338
Reputation: 10,379

Post » Sun Mar 31, 2013 6:35 pm

Thanks you very much! Will definately check it out!
B
22
S
7
Posts: 316
Reputation: 2,490


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests