Problem with z property (Character)

Started by FlyRider, Tue 01/11/2005 22:24:36

Previous topic - Next topic

FlyRider

I've made a walking loop for my character. Now I realise that I need to higher the point where the character should meet the ground. Right now it's kind of floating above the ground and that's not whwt I want. Is it the "z property (player)" I should change then? And if that's the case, why do I get an error when I write?:

EGO.z= -20

Ashen

I think you've got the right property, but try:

cEgo.z = -20;

Or (works, but isn't the usual way):

character[EGO].z = -20;
I know what you're thinking ... Don't think that.

RickJ

I think you want to crop the bottom of your character sprites.  The Z property allows flying charatcers such as birds to be scaled properly as the fly into the background.   

FlyRider

#3
I put "cEgo.z= -20;" in the gamestart section but all I get is Unexpected 'cEgo'

When I tried "character[EGO].z= -20" I got something like '[' already defined.

What is wrong?


RickJ: Even if I crop it, it ends up a little to high because of the animation.

monkey0506

When you say you put it in the "gamestart section" do you mean between the #define-s?  Because it needs to be after the line "function game_start() {" (the bracket may appear on the next line).  So it should look something like:

Code: ags
#define sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
  cEgo.z = -20;
  /* stuff */
  }
#define sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


And as for "character[EGO].z = -20" producing a "'[' already defined" error, you probably put "Character[EGO].z = -20", which is inappropriate because AGS is case-sensative, and Character is a struct which you can only define pointers to, where the character array is an array of pointers to objects of the Character type.

[EDIT:]

If you're confused by that last bit, just realize that "character" and "Character" are different (capitalization matters!).

FlyRider

Thanks,  monkey_05_06, for reminding me about the brackets! Somehow, I'd managed to put the command between the last bracket and #define sectionend game_start. But now it works fine! I shure will recheck the bracket thing in the future...

monkey0506


Elliott Hird

May I announce that that should not work. It should be cEgo.z = cEgo.z - 20.

DoorKnobHandle

Elliott:

Code: ags

i = -20;


This will set the variable "i" (or in this case "cEgo.z" - same thing) to -20.

Code: ags

i = i - 20;
// ... is the same as ...
i -= 20;


This will take 20 away from i.

Thus there's a difference, imagine i to be 100. In the first case, i would turn up to be -20. In the second it would become 80.

I think he wanted to make the cEgo.z variable equal -20 in this case, but if he wanted to just position him 20 pixels higher than whereever he was, than your suggestion is right.

Elliott Hird


SMF spam blocked by CleanTalk