Author Topic: Paths  (Read 4971 times)

Uhfgood

  • Regular
  • **
  • Posts: 26
    • AOL Instant Messenger - Uhfgood
    • View Profile
    • Indie Flux
Paths
« on: 2006-01-25, 12:29:04 AM »
Is there a way to interactively edit paths, like adding more points, deleting points, etc?  Other than just deleting the whole path and starting over when you screw up?

Keith W. II aka Uhfgood
Keith Weatherby II
http://www.gamesafoot.com
Uhfgood -at- verizon -dot- net

Dr Obvious

  • Regular
  • **
  • Posts: 53
    • View Profile
    • http://www.drobvious.net
Re: Paths
« Reply #1 on: 2006-01-25, 01:19:27 AM »
You can edit paths in the sprites tab.  Its been a while and I'm a bit tipsy at the moment, but I'm pretty sure you can add, delete, and edit points in the path.  It's either that or you can just mess with the delay.

billybob884

  • Contributor
  • Fanatic
  • **
  • Posts: 355
    • AOL Instant Messenger - billybob884
    • View Profile
Re: Paths
« Reply #2 on: 2006-01-25, 05:02:43 AM »
the only way to add additional points to a path or modify only 1 point as opposed to offsettinghte whole path is by exporting it into xml and finding the points in there. gamedev has a limited ability to modify paths from wihtin itsself, you can delete points, add in delays between them, and move the entire path a specified amount, but thats it.
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." :: Hitchhiker's Guide to the Galaxy

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Paths
« Reply #3 on: 2006-01-25, 06:43:37 AM »
Any scripting genius wanna give this a try?  You could write a design time script that detects when someone presses "P" in the map editor, and then snap the nearest path point to the mouse pointer until "P" is pressed again.  If "D" if pressed, delete the point.  If "C" is pressed create another point after the snapped point.  Note: you will have to remove and re-insert the point to move it because the path object does not expose the ability to directly set the position of a point.  Other than simply moving the points around, you shouldn't have to write code to track the mouse or draw the path.  The map editor's built-in path drawing should track the current state of the path as it is edited (if you have "show all paths" turned on).  And the mouse position is simply a pair of properties in the map editor (remember to add XOff to MouseX and YOff to MouseY to get the absolute position of the moue within the map).  More math will be required if the script is to work properly with map displays that don't align with the top-left corner of the screen or layers whose scroll rate is not 1.  But we can work that out later.  Use the delivered design-time script (gamedev.vbs?) as a starting point, or start a new one based on the example template (MapEdit.vbs).

Uhfgood

  • Regular
  • **
  • Posts: 26
    • AOL Instant Messenger - Uhfgood
    • View Profile
    • Indie Flux
Re: Paths
« Reply #4 on: 2006-01-25, 05:07:16 PM »
i'm not a scripting wizard, i'm not even an apprentice - However.  Okay let's say we modified MapEdit.vbs - how do you get gamedev to use it?

Keith
Keith Weatherby II
http://www.gamesafoot.com
Uhfgood -at- verizon -dot- net

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Paths
« Reply #5 on: 2006-01-25, 07:25:47 PM »
We just talked about design time scripts for the map editor in this thread:
http://gamedev.comdel.net/index.php?topic=699.0

If you already have the script, connecting it couldn't be easier.  Be sure to use the file name gamedev.vbs and put it in the gamedev.exe folder ("c:\program files\gamedev")  Then it will auto connect whenever the mapeditor is opened.
I've made a pretty useful one that you can download in the above mentioned thread and try to get to connect.


Anyways, it looks like i've been volunteered to try to make this path editing thing happen :),  shouldn't be a problem especially if it frees Ben's time to work on SGDK2.

I will probably just continue to modify and upgrade my current from the tread above.  Stay tuned for updates.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Paths
« Reply #6 on: 2006-01-26, 10:04:06 PM »
Didn't I deliver a GameDev.vbs with version 1.4.6 or 1.4.5?  There was a script that Orion Pax and I had worked out to help switch between layers and hide layers -- I thought I included it in a recent release.  I guess it's not in the "What's New" list so maybe I didn't.

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Paths
« Reply #7 on: 2006-01-26, 11:17:48 PM »
I did find a copy of Gamedev.vbs with 1.4.6 but it was mostly blank with short discriptions of some of the events, but a good starting point for one, no layer stuff that I saw

K, here is what I have for an all purpose script that increases the functionallity of the map editor.  Most noteable, I added path edits.  You can move points around, insert points, delete points, and add points to the end.  It also displays the per pixel coordinates so you can place points exactly where you want them.  It can basically do anything except add in delays, but it can delete or rewrite them.

I think I worked most of the bugs out of it, but I haven't tested it on layers with a scroll rate other than 1.  I strongly recommend you backup your project before using and save frequently.

In case you haven't read the previous posts, its really easy to "install"  just download GameDev.vbs and copy it to "C:\Program Files\GameDev\".  Open the map edior with any project and the script connects.

(Please report any bugs including error code, line numbers, conditions, reproducibility, etc)

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Paths
« Reply #8 on: 2006-01-30, 11:31:33 PM »
Anyone Try this yet?

I'm kinda anxious to see what everyone thinks.  I've used it a little bit and like it, but not too much as I haven't had time to really sit with it yet and design or edit some maps.  I'll try to give an objective opinion on it so far.

Controls could probably be improved a little bit, I think I used intelligent letters for each of the commands, but I'm sure they could be improved (like all be in the asdf row so you don't have to move your hand).  I opted to use all keyboard control for path editing instead of having a mouse click select a different point.  This was mainly to keep it simple for programing.  I didn't feel like messing with the button up and bottom down events or changing and trying to determine what "mode" (add to end, replace, insert) of path point editing the user wanted.

The controls, since there are starting to be so many, begin to dominate the screen, so I put in the option of turning off the controls display.  Not too big of a problem.

If i make a further revision I plan a few of the following things:

- Special function movement.
- X, and Y, lock.  To make it easier to draw a row of tiles quickly without "going over the lines" into the other row or column, among other things.
- Snap scroll.  Only draw at the corners of tiles (0,0), useful for placing path points exactly on or over a tile among other things.
- I might try layer jump/hide, as bluemonk talked about, but I'm not sure yet.
- Point save, press a button and it saves the position of that point so you don't have to remember later.  Use it for "move back" or to remember later for alignment purposes.
- Tilematch Toggle, toggles quickly between the different tilematches.
- Tile number display.  Displays the index number (0-256) or all tiles on the screen.
- Top/Left enlarge.  Normally you can only enlarge maps the right or bottom.  Make it possible to do it from top or left too.

What ya think?


bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Paths
« Reply #9 on: 2006-01-31, 06:52:18 AM »
Have I ever posted this other script I have?  It does the layer switching and hiding.  Orion Pax made some modifications to it too; I don't remember if this is the one he modified or just the one with my code (I don't remember what his modifications were).