[FIXED]Getting pointer to spawner returns orxNULL

edited October 2011 in Help request
3 people have been busting their heads over this one and can't figure it out. We have an object defined as orxOBJECT *player in our code, and we want to grab a pointer to a spawner created in the config file and owned by player.

What we do is call orxOBJECT_GET_STRUCTURE(player, SPAWNER) to get this spawner in the init function right after we call player = orxObject_CreateFromConfig("Object"). However, on the first call to change the properties of the spawner, the program crashes, claiming that the spawner pointer is orxNULL. Why are we not able to get the pointer to the spawner? If we can't is there another way to access the properties of this spawner?

Comments

  • edited October 2011
    Your code is perfectly fine. Can I see your [Object] config section?

    If the section is valid, it probably means you're doing a mistake by mixing release and debug: either you link against the release library and you define __orxDEBUG__ or you link against the debug library and you forgot to define __orxDEBUG__ when compiling your game. But let's check the config first. :)
  • edited October 2011
    Putting __orxDEBUG__ in my preprocessor definitions stops the program from crashing spectactularly. Thanks!

    We got the spawner mostly working now. We're using it to fire player bullets. Do you know if it would be practical to use the spawner class for something like firing complicated and coordinated patterns, like something you'd see in a top-down shooter game? (If you don't know what that looks like, look up Touhou or RefRain Prism Memories, those are good examples.)

    Once again, thanks for all the help.
  • edited October 2011
    Glad it worked.

    As for spawners, yes, you can use them for more complex stuff like in bullet-hell shooters. What you spawn are objects so they can have their own behavior. You can also do more advanced stuff by listening to the spawner events and modifying the spawned objects on the fly.
  • edited October 2011
    Epic! Man, I'm glad I found this game engine. I hope it gets some noteriety soon, you deserve it.
  • edited October 2011
    I'm glad you like it!

    Don't hesitate to spread the word around you! I tried a few times on some game dev-related forums over the past few years but I'm definitely not a very good communicator. :)
Sign In or Register to comment.