A question for fellow programmers

Discussion and feedback on Construct 2

Post » Fri Dec 12, 2014 12:42 am

Hello dudes,

I would like to ask you something.
I've made a game for a person who wants to upload it on its server and make an online score database etc.

The person told me that their current php framework does not allow relative paths, only absolute paths and thus requires him to include all the asses with absolute paths.

He wants me to make a global variable that will store the absolute path. This global variable will concatenate with the original files emplacement.

(i added an image)
question.PNG


--> the second hyperlink is the stored variable.


This seems very strange to me. Plus i don't think you can use global variables created in construct externally and If i create one directly in code i am wondering if it will work.

So is there a better way to do this rather than adding a global variable to all includes/src. (this will go crazy with JSON format)

Many Thanks!
You do not have the required permissions to view the files attached to this post.
B
9
S
3
G
1
Posts: 128
Reputation: 1,116

Post » Fri Dec 12, 2014 8:45 am

Seems pretty strange to me too...

Construct2 does not export php code, so it shouldn't care about paths. If you want to pass data back and forth from the game to php/mySQL then you should use the AJAX object to call a php script that will read or write data to a database.
B
98
S
35
G
20
Posts: 438
Reputation: 17,875

Post » Fri Dec 12, 2014 4:38 pm

Yep I thought this too because cmon php can trigger the index.html i presume but once it's triggered js executes itself. you don't need to load all the stuff with PHP. Am right?
B
9
S
3
G
1
Posts: 128
Reputation: 1,116

Post » Fri Dec 12, 2014 8:37 pm

You are correct, just make a link to the index.html of the game - it should run fine.
Once the game is running, then use ajax if you need to pass in any data from the web site, like username (if you have to log in to his site), or high score lists, character profiles or other data from a database that you need to save between sessions..,

You can also use the Browser object to have the game navigate back to whatever page in his site he wants when the game is over.
B
98
S
35
G
20
Posts: 438
Reputation: 17,875


Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests