Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / changing between project files

Author
Message
kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 27th Jan 2013 20:58
im making an app with agk and i was wondering how i would get agk to chang ebetween \'files\' within a project. this is because i would like to make an app then have a game in the app but i dont want to mix the text so iw as wondering what code could i use to change \'file\'? thanks

kirtnicholls
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Jan 2013 22:31
I might be misunderstanding but if you mean you want to add a new ".agc" code file to the project simply click on the File menu, choose "Create new file" (I think it's called that) and then when prompted save the file. Finally you must add a line to the start of your main source code file:


I hope that answers your question?


this.mess = abs(sin(times#))
kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 28th Jan 2013 10:40
I've tried that, but when I press the 'play' button it doesn't run the code separately

kirtnicholls
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jan 2013 10:45
I'm not sure what you mean. Are you tring to make a new separate application? If so just use "File->New Project"


this.mess = abs(sin(times#))
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 28th Jan 2013 11:59
You can have 'however' many projects open at the same time, they all reside and are selectable on the left hand side, then above the code window each source file should be a tab.

You can even save your whole workspace - so when your done, you can just save everything, then save your workspace as a seperate file - then when you get back to it, just load the workspace and your projects you were working on will all be there.

To make a secondary project, like if you have a game project, and alongside it you need a level editor project for it, then create a new project and specify the same folder to store it in, but give it a different project name of course. You might run into issues, like maybe when you compile, you can only compile one of the projects at a time, as the project bytecode might be set as a specific filename, so 2 projects can't exist at the same time with the same bytecode file. The only way to know, would be to try making a secondary project inside another projects folder. An option to get around this would be to dynamically specify the folders in the level editor project - like load the media and save the data in the required location, maybe directly specifying the main projects media path.

I got a fever, and the only prescription, is more memes.
kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 28th Jan 2013 17:57
Sorry I'll try explain myself a bit better. I have 2 apps: one is informative and one is a game, on the informative app I have added a button which I want to run the game upon being pressed. I don't want to mix the 2 pieces of script so but when I hit the button I'd like the game to run. This is where I thought a new 'file' would help me but so far it hasn't made any difference

kirtnicholls
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 28th Jan 2013 18:23 Edited at: 28th Jan 2013 18:24
Just put everything withing the 2'nd file inside a function, and then use the include command, as baxslash suggested, and when the button is pressed and released, call the function.

File 1:
---------
#include "File2.agc"

Do
Display some information

if button is pressed
game()
endif

Loop

---------

File 2:
---------
function game()
do game stuff
endfunction
---------

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.

Login to post a reply

Server time is: 2024-05-07 00:58:51
Your offset time is: 2024-05-07 00:58:51