Jump to content


Photo

anyone please help ?


  • Please log in to reply
5 replies to this topic

#1 marfin201

marfin201

    GMC Member

  • New Member
  • 170 posts
  • Version:GM8

Posted 21 May 2012 - 02:15 PM

/*var*/ //state_anim[0,0] = spr_man_down;
there's a code like this in create event
what does mean ??....
can anyone explain ??
  • 0

#2 @Alex@

@Alex@

    Retired GMC Reviewer

  • Reviewer
  • 3146 posts
  • Version:Unknown

Posted 21 May 2012 - 02:29 PM

Well it actually does nothing in its current state as it's within a comment. Comments are started with /* for multiple line comments or // for single line comments , the need to be ended with */ for multiplie line comments and need not be eneded for single line comments but you can't put any code you wish to function after the start of a comment on the same line.

It appears to set the 0,0 entry of an array holding animation states with the unique id of the resource spr_man_down. Perhaps you should look into arrays and study this person's code in a little more detail (since it is clearly not yours).
  • 0

#3 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 21 May 2012 - 08:03 PM

Uhh... this is a trick question, right?
/*var*/ //state anim[0,0] = spr man down
This does absolutely nothing because it is a comment. Comments do nothing other than give info

but this...
var state_anim[0,0] = spr_man_down
...also does nothing because you can't assign arrays to the 'var' function

and this...
var; state anim[0,0] = spr man down
...does nothing as well cause the 'var' is not assign to anything and the spaces cause sooo much separation that they render errors.

for this...
var; state_anim[0,0] = spr_man_down
...does the right thing. (except the 'var', since it's not assigned to anything it's useless)
You setting variable 'state_anim[0,0]' with the value of 'spr_man_down'
  • 0

#4 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 5234 posts
  • Version:GM8

Posted 21 May 2012 - 11:26 PM

var state_anim[0,0] = spr_man_down


sets array index 0,0 of variable state_anim to the sprite index of spr_man_down.

var is commented out because it doesn't work and he's debugging. probably left-behind code.

Edited by TheouAegis, 21 May 2012 - 11:28 PM.

  • 0

#5 marfin201

marfin201

    GMC Member

  • New Member
  • 170 posts
  • Version:GM8

Posted 23 May 2012 - 05:58 AM

Uhh... this is a trick question, right?

/*var*/ //state anim[0,0] = spr man down
This does absolutely nothing because it is a comment. Comments do nothing other than give info

but this...
var state_anim[0,0] = spr_man_down
...also does nothing because you can't assign arrays to the 'var' function

and this...
var; state anim[0,0] = spr man down
...does nothing as well cause the 'var' is not assign to anything and the spaces cause sooo much separation that they render errors.

for this...
var; state_anim[0,0] = spr_man_down
...does the right thing. (except the 'var', since it's not assigned to anything it's useless)
You setting variable 'state_anim[0,0]' with the value of 'spr_man_down'

Sorry for late to reply.
Thanks for advanced :smile: I thought that was a complicated code not a comment.
Ok that's mean assign the changing of sprite index wherever they move, doesn't it ?
  • 0

#6 NukeTheCat

NukeTheCat

    GMC Member

  • GMC Member
  • 470 posts
  • Version:GM8.1

Posted 23 May 2012 - 07:56 AM

Uhh.. yeah.
example:
sprite_index = state_anim[0,0];
//you must be very  precise about this

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users