Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Help]What am I doing wrong with this code?!!?!  (Read 923 times)

0 Members and 1 Guest are viewing this topic.
[Help]What am I doing wrong with this code?!!?!
« on: December 08, 2007, 01:49:27 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
What am I doing wrong with this code?
Code: [Select]
object_set_solid(self,1)
object_set_parent(self, objFloor)

I put the "ind" as self, because its for the current object that the code is in.
I put 1 in as the solid, because  I want it to be solid, and I put objFloor as it's parent.
But nothing's working!!
What wrong

-Mewgull

PS: What does "ind" mean anyways? and what should I put ind as for future referance?
Logged
Re: [Help]What am I doing wrong with this code?!...
« Reply #1 on: December 08, 2007, 03:03:44 pm »
  • 笑い男
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2124
this is how i go about such problems

find what you want (in this case, object_set_solid)
go to the help, search for "object_set_solid"

object_set_solid(ind,solid) Sets whether instances created of the object must default be solid (true or false).

ok, quite obvious, but it says nothing about the arguments, so lets look up a bit at the other generic ones

object_set_sprite(ind,spr) Sets the sprite of the object with the given index. Use -1 to remove the current sprite from the object.

so ind must mean the object

and so, you're using it correctly.

but, there are alternatives

"solid=1"
is what i've always used. never even knew "object_set_solid" existed.

but you see, object_set_solid probably sets the OBJECT to be a solid one, not just that instance (so you can object the general object properties whenever.)
self refers to that INSTANCE of the object. so that wont work

solid=1 will be fine though.

again, the same goes for "object_set_parent"

but thats something special. you wouldnt really want to change that on the fly O_o

but if you really do :S then you need to change the parent for all instances of that object it seems and so:
"object_set_parent(objWhatever,objFloor)"

objWhatever being the object you want to alter.
like i said, "self" applies to that instance and that just wont work in this case. as these are to change the actual object properties.
Logged

この世に悪があるとすれば、それは人の心だ
  • .hack//The World
Re: [Help]What am I doing wrong with this code?!...
« Reply #2 on: December 08, 2007, 04:50:04 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Thanks, you cleared up a lot for me :)
It works now. I just had to do it from a different object and not in the "step" event
Logged

mit

Re: [Help]What am I doing wrong with this code?!...
« Reply #3 on: December 08, 2007, 05:23:38 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Yeah, the object_set_ functions are for changing the 'master' values, that an object will have when it's created.

To set something to an object that exists already, use 'solid' or 'object0.solid'
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.286 seconds with 45 queries.

anything