The Daily Click ::. Forums ::. Klik Coding Help ::. Menu placement and Grass
 

Post Reply  Post Oekaki 
 

Posted By Message

Devernath



Registered
  04/12/2004
Points
  54

VIP Member
2nd May, 2009 at 07:38:43 -

Ok, I have two *relatively* simple problems....

One, Menu placement. In this 4 direction scrollng game, I want a menu to always appear in the top right.

I can't just unclick follow the playfield because the character can appear anywhere in the world map at the start, and if the menu item is in the top left and the character spawns bottom right, its not visible.

I can't just make it an "Always set positiong to postiion of player" because it begins to disappear when the player reaches the window's edge.

I COULD make a boundary to prevent that, but it cuts up ALOT of level space.

Basically, I need a way that the menu is always visible in the player no matter where he spawns or what position he's in.

Secondly, Grass. When my character walks through tall grass, I want his body covered only up to his neck. With simple "bring to front" the grass on top covers him entirely.

I'm a noob, and I'm sorry for that .



 
n/a

nim



Registered
  17/05/2002
Points
  7233
2nd May, 2009 at 09:01:54 -

Menu - use the expression
Always
-- Set X coordinateof "Menu" to X Right Frame - 60
-- Set Y coordinateof "Menu" to Y Top Frame - 10
(change 60 and 10 to whatever is needed)

Grass - If you're using MMF2 or TGF2 you can put it on a layer above the player sprite. If you're not using MMF2/TGF2 then you can use the Active System Box or simply a whole lot of actives (not really recommended, though.)

 
//

-MacAdaM-

Megaman Fosho

Registered
  12/02/2008
Points
  560
2nd May, 2009 at 13:17:05 -

For grass a really simple (and kind of cheesy way) to do it is to draw a animation of him(her?) to be covered by grass, and when he(she?) is overlapping the grassm just play the animation.
This would be for a quick fix though, but it you actually want it to look nice, i would go with what Nim said.
About the menu, Nim also has it right on the dot.
It is exactly what I would say

 
Your just jealous that you're not as awesome as me.
(And my megaman avatar )

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
2nd May, 2009 at 13:31:59 -

What Nim suggested would cover him entirely. To get the effect you want with grass going up to the guy's neck; create grass actives that are neck-heigh and then put them everywhere and use the layer object to always layer the objects by their y position.

 
n/a

Mark McCauley



Registered
  18/02/2009
Points
  291

Has Donated, Thank You!VIP Member
2nd May, 2009 at 14:26:55 -

or another way using only one object active(grass sprite in front of character)


if active object(character) is in zone(s)x1,y1,x2,y2 then
set xpos(grass) to ( ( X( "character" ) / 10 ) * 10 ) + 10
set ypos(grass) to n



A Rudimentary Example , may need tweaking but i just tested it out and its workable,

 
http://www.reddwarf.co.uk/forum/messages.cfm?threadid=44227736-C46F-AC56-02EBA05285818C14

Devernath



Registered
  04/12/2004
Points
  54

VIP Member
2nd May, 2009 at 21:50:07 -

With the grass, I could easily create an active sprite of the grass and have it always in front of the character, only made visible when he is in the grass backdrop.

But then it looks like an extra grass is being created as he steps in, but w/e, a minor aesthetic thing.

The menu position works fine, however, I encountered another problem.

I want Z to open the menu, and close it.

So i try

Start of level make menu invisible
If Z + Menu invisible, make menu visible
If Z + Menu visible, make menu invisible.

But, this seems to make it both happen at the same time (it ends up with one or the other, and i hold Z it flashes). So I try

Menu visible, set A to 1
Menu invisible, set A to 2
If A is 2 + Z, set A to 1 and menu visible
If A is 1 + Z, set A to 2 and menu invisible.

But the same result happens. What do I do?

How can I change this?

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49567

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
2nd May, 2009 at 22:19:16 -

"Z" pressed-
-Toggle Flag

If Flag is on set menu visible
If Flag is off set menu Invisible

done


 
n/a

Devernath



Registered
  04/12/2004
Points
  54

VIP Member
2nd May, 2009 at 22:27:23 -

Heh, that works. Thanks, i didn't know what "toggle" meant.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49567

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
2nd May, 2009 at 23:31:51 -

glad I could help

 
n/a
   

Post Reply



 



Advertisement

Worth A Click