# determining the height

Member Posts: 17
edited May 2012

I got a first project that prototype as the above link.

I was looking on some solution or any GS function to identify the height (labeled green) on the stable platform ( gray one ) to its next platform( red, movable platform). considering that there are variations (diff. height and width) of movable platform.

There are several arrangement of platforms that follows after this. I was thinking to identify dynamically the height.

the hardest part for me here is that to identify the heights (green arrowed gap) of the preceeding platforms.

• Posts: 647
@cyberghost

Just to clarify what you are asking... So you want to have an integer attribute constantly keeping track of what that distant is?
• Posts: 647
@cyberghost

Ok. It would require quite a few game attributes though. Does that matter? Why exactly do you need to know the distance?
• Posts: 647
@cyberghost

There we go, now I see what you are saying. As of right now this doesn't seem like a simple solution, so I'll see if I have time tomorrow to sort this one out.

Regards,
Jack McGraw
• Posts: 2,859
@cyberghost -- if you are trying to find the difference between the top of the gray box and the top of the red box the general formula looks something like:

distance = (graybox.Y+(graybox.height/2))-(redbox.Y+(redbox.height/2))

Hope that helps
RThurman
• Posts: 647
@cyberghost

Hello,

Just got home from school today and finished up a demo for what you are looking for. Depending on how high you fall from, you will lose health damage. With a few small alterations, this demo will work no matter where you place platforms in your game, and requires a minimal # of attributes.

http://dl.dropbox.com/u/16233669/falling health damage.gameproj.zip

Let me know if you have any questions about the demo. You can also email me (jckmcgraw@gmail.com).

Hope this helps,
Jack McGraw
• Posts: 647
@cyberghost

Don't overthink GameSalad... You'll just want an integer attribute. Then when you overlap or collide (rule) with an object, change attribute game.collectableobjects (or whatever), to game.collectableobjects + 1

Regards,
Jack McGraw
• Posts: 2,456
tables in GS are our arrays for storing values

loved @jckmcgraw demo … colorful and so efficient!

I had started a demo using tables … thought Jack's was much better

http://www.mediafire.com/?o1h94g1biogwm9r

==
so many ways to creatively create in GS!

MH
• Posts: 647
@cyberghost

With tables, you can insert a bunch of info (attributes), but you cannot change the table cells on the fly. All you can do is retrieve the values that you put in.

GS is working on implementing writable tables in the next one or 2 updates.

Regards;
Jack McGraw
• Posts: 2,456
@cyberghost … you can fetch any of the data you stored in a table …
expression editor: Functions for tables

to learn about GS tables … watch: http://gshelper.com/?p=450
and the other @tshirtbooth tables videos … most with downloads of projectFiles

his work made tables easy for us …

MH

• Member Posts: 17
yeah getting the distant on every consecutive platform.
• Member Posts: 17
hmm it does not matter of how many attributes involved.

My goal is that to get he distance between the proceeding platform for me this conditions.

[game situation]
lets say when the user (player) used to catch the actor in 100 px or more (height). the actor will take a considerable about of damage.
• Member Posts: 17
thank you sir.

• Member Posts: 17
@RThurman > formula dude. this very quite understable ( quite an analytical geometry solution ).

but the thought of getting the preceeding distances on approaching boxes is quite a hell to me... i was thinking that there are some array object handler. but i guess there is not.
• Member Posts: 17
@jckmcgraw, thanks sir.. in one way or another the idea there is basically you are putting the danger zone area.

with this i have done about the logic itself.

i just wondering if there is a mechanism/codes that collect objects on a scene? like an javascript that capable to fetch/read recursively any object on its container?
• Member Posts: 17
@jckmcgraw, thanks for the advice sir.

but i was thinking if there is a sort of array objects? i mean its an array variables that get all objects and its details (properties eg. positions, width. height). damn to me.. im start thinking already as javascript already..
• Member Posts: 17
is the table in GS can be updated dynamically? or can that be inserted a new entries? By the way, what im trying to say is that.. can we fetch the objects (e.g platforms, bars) and its attributes and placed on tables? honestly this will be my first time using tables.
• Member Posts: 17
@MotherHoose and @jckmcgraw, wow! this is a great help to me as a beginner.. thanks for your ideas and infos.

• Member Posts: 207

the game salad forums have degenerated to people posting temporary links at eachother.

• Member, Sous Chef, PRO Posts: 2,859

Please don't post 'off-topic' in very old posts.