The Daily Click ::. Forums ::. Klik Coding Help ::. More convenient way to set global positions?
 

Post Reply  Post Oekaki 
 

Posted By Message

JetpackLover



Registered
  01/03/2007
Points
  212
3rd November, 2009 at 14:34:17 -

TL;DR ver.

Is there a more convenient way for setting global positions so that I don't have to manually edit the values each time I resize the frame?

This isn't a problem so much as it is a point of convenience for me. More times than not I'll end up changing the size of my frames after I set global positions which means I have to go to each frame and change them for the new frame size. Quite frankly, it's a pain.

Is there some way where I can have the global X/Y positions of my player read by a global ticked active objects X and Y?

Another reason I want this is because I hate having to go check exactly where the position of my guy should be when he enters a new frame. I want to be able to take an active and drag it to where I want my guy to show up. And if I move the active my guy will follow it. Which would make editing he start and exit positions per frame soooo much easier.

I did try to make it work but I kept coming up to the same road block.

Here's what I tried

I created 4 active objects called "Exit 1", "Exit 2", "Exit 3", "Exit 4" and I ticked them global. I made 4 since there are 4 possible ways of entering the frame. I made alterable values for each called "X position, and Y position" And I had it so these values would retrieve data from the actual X and Y. For the sake of testing I only used "Exit 1"

I would then place these actives where I wanted the player to show up in frame.

Then I made a blank frame with all 4 Exit actives because if they weren't there I wouldn't be able to code for them.

Sooo for the blank frame I have code that says

"Start of frame" >Set Global X and Y to retrieve data from "Exit 1" X position and Y position and Jump to frame 2.

(I'm sure you already see a problem with this...it's retrieving the data from the Exit 1 that is in the blank frame before it jumps.)

I figured it would work because I ticked them global...but it didn't.

So now that I know what's wrong does anyone have a solution for how this can be done? It's for my sanity

Also just want to say thanks to all the folks that help me out. I'm completely helpless without this community.

 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover


Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
3rd November, 2009 at 20:41:50 -

Global active objects don't work globally in runtime as far as I know, just that if you edit the actual object in one of the various editors (animations, behaviors, default values, etc.) those will change for all copies of that object in each frame. What I'd think of is having either two global values, one global string and one global value, or one global string.

If you use two global values, set them to the proper X and Y positions, then set those positions in the next frame.

If you use one string and one value, set the String to the exit's name, and the value to whatever X or Y position would differ (if the exit were a long horizontal for example, you'd set that value to the X position because the Y position doesn't differ across the object).

If you use one string, set the string to the exit's name and set the object's position relative to that one in the next frame.

With the string ones you'd have trouble because you'd have to make separate events for each Exit object. Which makes me wonder, why wouldn't you just use one object, spread a value in the first alterable value, then test like that? Then the string would be a value and tell you which object to set the object next to:

Start of frame

=Spread value 1 in alterable value A ("Exit")

Start of frame
+Alterable Value A ("Exit")=Global Value A
= Set Player position 0,0 relative to Exit


Or whatever.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
3rd November, 2009 at 23:16:48 -

Global active objects don't work globally in runtime as far as I know

I wasn't sure so I made a quick test. They do work globally at runtime. If you save an alterable value in an active and then if you have copied it into another frame it will retain its alterable values across frames.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
4th November, 2009 at 06:40:28 -

That's interesting, I actually never even saw the point of ticking the "Global Object" box. But now I know, so I suppose that could be really useful in the future.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click