The Ever-Growing Tile Editor

For questions about using Classic.

Post » Sat Oct 27, 2012 1:56 am

I'm glad that I could be of help
I wished there was some similar way of helping for drawing and painting. That's where I'm helpless. (Imagine a 3-years-old painting dad and mom, that's close to my results )
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Oct 30, 2012 6:23 am

So the text objects are all created and they now have all the right file names in them... But they all overlap

Which way do I change that? If I create an event based on text overlapping text, it effects everything.

I think I could maybe set the UIDs of every text object to an array, then check each array value against the UID it represents and somehow the position... but I can't quite wrap my brain around this. Is there an easier way?
B
7
S
2
Posts: 123
Reputation: 1,061

Post » Tue Oct 30, 2012 11:12 pm

This is where I am as of now.



This is supposed to cycle through the array in the subevent and move each Text object, but currently it doesn't do anything. I haven't been able to find which part isn't working right now.
B
7
S
2
Posts: 123
Reputation: 1,061

Post » Wed Oct 31, 2012 3:55 am

[QUOTE=tulamide]
+ some condition that indicates loading begins
-> Array: Set size to File.FileCount(apppath & "/images") x 1 x 1
-> System: Set global variable 'count' to 0
++ For Each File in apppath & "/images"
--> System: Add 1 to global variable 'count'
--> Array: Set index global('count') to File.CurFile
++ For each element
--> Create Object Text on Layer 1 at ((Array.CurrentX % 10) * 30 + 20), (floor(Array.CurrentX / 10) * 30 + 20)
[/QUOTE]

I basically used this for creating text objects. There are 71 files in my images directory.

... 5042 text objects are created. This is where my troubleshooting has left me.
B
7
S
2
Posts: 123
Reputation: 1,061

Post » Mon Nov 05, 2012 11:36 pm


Turns out the best way to do this was with a generic loop:

[QUOTE]For Each File in apppath & "/images/"       
- Add 1 to var 'count'
- Array: set index:global('count')to file.CurFile

Is global('count') equal to             
File.FileCount(apppath & "/images/"       
- Start Loop "createtext" and run Array.SizeX times

On loop "createtext"                    
- Create Text                            
- set text to Array(Loopindex)[/QUOTE]
This created only the necessary objects. I left positioning the text to another probably unnecessarily long chain of events, but am happy to report that all the objects are created as planned. I can essentially just copy these for my tile objects when I get there.

Now my new problem... Making the scrollbar control the position of the text.


The first thing I've done is created a global variable that records the position of the scrollbar as a percentage of how far along it's track it is.

Then I've created a global variable for how tall all of the text objects are. With simple math I find the beginning of all the text objects, and the end.

Then on my scrollbar buttons I've created an event
[QUOTE]
Mouse is over Downbutton              
Left Mouse button is down            
- Set Scrollbar.Y to Srollbar.Y + 1
- Text: Set Text.Y to lerp(global('beginning'),global('end'),global('scrollposition')[/QUOTE]

Since 'scrollposition' is a decimal should it not set Text.Y to the proportionate position? Instead it scrunches all the text objects together at the top of the screen. I can change it to:

Text.Y + lerp(global('beginning'),global('end'),global('scrollposition')

This stops it from scrunching all the objects up on top of eachother, but it scrolls through everything so fast there is still about 75% of the scrollbar left.

Any ideas on how to do this?
B
7
S
2
Posts: 123
Reputation: 1,061

Post » Wed Nov 07, 2012 1:22 am

lol wow, you think this makes programming easier? :)

I was interested in the thread though I am trying to implement a similar thing with python so i can dump out the tiles and delete them as my player wanders about, the problem I have, it getting hold of something universal I can kill objects spawned.

I can use SOL.<last objecthere>.UID to get a unique UID and then I can store it for later reference, but I don't seem to be able to just kill things by UID

anyway was just saying this looks AS complicated as a normal programming language

B
4
Posts: 31
Reputation: 412

Post » Wed Nov 07, 2012 4:13 pm

R0J0hound showed me a trick to deleting tiles as your sprite wanders about. It used private variables instead of UID.

See if this helps at all.

http://www.scirra.com/forum/drawing-to-a-minimap-clearing-offscreen-objects_topic57881.html

I'm not a programmer so I'm not sure if it is actually as complicated, I don't find typing things out that complicated, I think construct can make that part easier through it's event editor, I just find the logic hard to wrap my head around. Probably just as hard as regular programming?

Anyways, I guess I probably have to make a new thread, still haven't made progress on my scrollbar issue, and probably no one wants to read the whole thread.
B
7
S
2
Posts: 123
Reputation: 1,061

Post » Wed Nov 07, 2012 8:12 pm

You could use the listbox object it specializes in a scrolling list of text.

If you still want to implement it yourself with events here is a example:
http://dl.dropbox.com/u/5426011/examples15/scrollbar.cap
Here are a few other examples of a scrollbar widgit:
http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=5343
http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=3809
and here is a uncommented cap of an advanced scrollbar.
http://www.scirra.com/forum/utility-2d-array-editor_topic41701.html
B
79
S
24
G
54
Posts: 4,741
Reputation: 40,745

Post » Thu Nov 08, 2012 4:37 am

Well thanks for teaching me a new lesson... Searching doesn't search the old site. I'll have to keep that in mind.
B
7
S
2
Posts: 123
Reputation: 1,061

Post » Thu Nov 08, 2012 10:28 am

[QUOTE=crowtongue]

I'm not a programmer so I'm not sure if it is actually as complicated, I don't find typing things out that complicated, I think construct can make that part easier through it's event editor, I just find the logic hard to wrap my head around. Probably just as hard as regular programming?

[/QUOTE]

You're tackling the same sort of problems so it's programming the same really, when I was really into Max MSP, i found at first I loved that I didn't have to code (it's a visual based midi music type programming thing), eventually though I found the visual thing to have a problem reminiscent of the wire problem they had with early computers... so basically I find visual programming the usual limitation is having to do a lot of copy and pasting sort of like functional programming (i think lol).


Where I am a bit stuck is still keeping track of items created in Construct, I could implement a tile map editor thing with what I currently have actually, because I could rely on the pick closest function as a dirty workaround to delete the tiles, however I want the same code to create enemies that then move about...

Reading your posts I get the impression that things created in events are more easily referenced somehow, anything created by python code:

System.Create(objectname, layer, x, y)

it just seems to end up floating (or lost), i can store all the UID's any bit of data right after creation... because you can find it with SOL.objectname.UID, you can do anything right after creation thank god otherwise my tile layer was laying tiles on top of my main sprites...

no but if you then create another sprite of the same type later, you can no longer reference the first one, and I have tried all sorts of syntax. For example objectname[1] would reference the second create sprite, but only if it's created by construct, not by "System.Create(objectname, layer, x, y)"


oh man this is driving me mad, i don't mean to put your thread off topic I don't think I am I think we're trying to do similar things, creating items that are under control of the code and then removed by the code etc...
B
4
Posts: 31
Reputation: 412

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest