Adding More Images

waifuslayer

Member
Jan 16, 2016
15
0
Is there a way to add more images. I know how to add the images by naming the images and such but i was wondering if there was a way to make it so more images could appear at different scenes. im not talking about multiple images to the same scene like image_1 and image_2 im talking about adding an image to a completely different scene.
 

hatternumber0

Well-Known Member
Aug 27, 2015
264
18
You'd need to edit the code itself. If you download the the source code and grab a flash editor you  can do it.


Just add your new image to the images.xml file (from the source code):


<ImageSet id="coc-new-awesome-picture">
<ImageFile>./img/coc-new-awesome-picture</ImageFile>
<ImageFile>./img/coc-new-awesome-picture</ImageFile>
</ImageSet>


And then add a call for it in the scene you want the image:

Code:
private function chosenScene()

Code:
         outputText(images.showImage("coc-new-awesome-picture"));
 

waifuslayer

Member
Jan 16, 2016
15
0
What flash editor would i need, also i have the folder for Coc is the source code in there? sorry im not too familiar with scripting.
 

waifuslayer

Member
Jan 16, 2016
15
0
You'd need to edit the code itself. If you download the the source code and grab a flash editor you  can do it.


Just add your new image to the images.xml file (from the source code):



<ImageSet id="coc-new-awesome-picture">
<ImageFile>./img/coc-new-awesome-picture</ImageFile>
<ImageFile>./img/coc-new-awesome-picture</ImageFile>
</ImageSet>


And then add a call for it in the scene you want the image:



private function chosenScene()

Code:
         outputText(images.showImage("coc-new-awesome-picture"));

I attempted editing it, but it didnt seem to work. I dont think i am inserting the call for it in the right area.
 

hatternumber0

Well-Known Member
Aug 27, 2015
264
18

That first one i said for images.xml should actually be:


<ImageSet id="coc-new-awesome-picture">
<ImageFile>./img/coc-new-awesome-picture</ImageFile>
<ImageFile>./img/coc-new-awesome-picture_1</ImageFile>
</ImageSet>


With that extra "_1" on the end of the third line.
 

statess

Active Member
Oct 19, 2015
44
2
i must be dumb... i have no idea how to put the coc images in the downloaded coc game...
 

waifuslayer

Member
Jan 16, 2016
15
0
That first one i said for images.xml should actually be:



<ImageSet id="coc-new-awesome-picture">
<ImageFile>./img/coc-new-awesome-picture</ImageFile>
<ImageFile>./img/coc-new-awesome-picture_1</ImageFile>
</ImageSet>


With that extra "_1" on the end of the third line.

I think im doing something wrong, what i did was go from the CoC folder to Classes-classes-scenes then the camp folder and inserting the call and added the call in the image.xml but it didnt seem to work.


this is how it looks in the area i changed it //-----------------
//-- CAMP ACTIONS
//-----------------
private function campActions():void {
    outputText(images.showImage("coc-new-awesome-picture"));
    hideMenus();
    menu();
    outputText("What would you like to do?", true)
    addButton(0, "SwimInStream", swimInStream, null, null, null, "Swim in stream and relax to pass time.", "Swim In Stream");
    addButton(1, "ExaminePortal", examinePortal, null, null, null, "Examine the portal. This scene is placeholder.", "Examine Portal"); //Examine portal.
    if (model.time.hours == 19) {
        addButton(2, "Watch Sunset", watchSunset, null, null, null, "Watch the sunset and relax."); //Relax and watch at the sunset.
    }
    else if (model.time.hours >= 20 && flags[kFLAGS.LETHICE_DEFEATED] > 0) {
        addButton(2, "Stargaze", watchStars, null, null, null, "Look at the starry night sky."); //Stargaze. Only available after Lethice is defeated.
    }
    else {
 

hatternumber0

Well-Known Member
Aug 27, 2015
264
18

Hrm. Try adding it just before the text. So it would be:

hideMenus();
menu();


outputText(images.showImage("coc-new-awesome-picture"));


outputText("What would you like to do?", true)
addButton(0, "SwimInStream", swimInStream, null, null, null, "Swim in stream and relax to pass time.", "Swim In Stream");

So the image is loaded at the same time the text is generated. You could also try changing the showImage line to:

outputText(images.showImage("coc-new-awesome-picture"), false);

I'm not 100% on what adding ", false" does, but some other calls have it and it seems to relate to scaling the picture down.
 

waifuslayer

Member
Jan 16, 2016
15
0

Ok so i think i know why this isnt working for me. I tried deleting all the writing it says in that scene by removing "outputText("What would you like to do?", true)". By removing this it shouldnt say that when i click it anymore, but it still does. So the file im editing either has no effect on the actual game and is the wrong one or theres another error.
 

hatternumber0

Well-Known Member
Aug 27, 2015
264
18

Are you using a program? The way it works is a flash editor will take the source code you've changed and build it into a working game.
 

waifuslayer

Member
Jan 16, 2016
15
0

Ya I'm using flash developer. What I do is open the file I want to edit with it and then edit it. Is there a better flash editor? Or maybe I'm just using it wrong.