Advertisement

I can't figure out how to do this.

Started by September 20, 2009 12:22 PM
1 comment, last by rpg gamer 17 15 years, 2 months ago
I am working on creating a sidescroller called 'A Mario Knockoff'. I realized I've never worked with anything but the player. I've never created an NPC that actually moves and interacts. I won't be able to officially test any answer to my questions until I rewrite and impliment my collision detection system. I figure I might as well start a topic and see what comes up. Here is what I've been pondering(?): 1. How do you create an 'event' system for sprites? I want to be able to simply feed the event system(load from a file) a series of commands and it follow them. My ideal was to feed flags to the (STL)list. The flags I've came up with are very basic: LEFT - move left(if ducking roll left) RIGHT - move right(if ducking roll right) UP - jump(see next question) DOWN - duck(if jumping do nothing) NULL - return to STILL animation DELETE - Delete everything and return to STILL animation 2. How would you make an animation 'arch' meaning the character jumps at an angle and then comes back down at an angle. NOTE: I can't implement 'gravity' until I have a solid ground to land on. That means I can't check if the path is free. So at the moment I have the sprite playing the animation and not moving. [Edited by - rpg gamer 17 on September 20, 2009 3:18:17 PM]
-----------------------------I heard the voice of the fourth beast say, Come and see.And I looked, and behold a pale horse: and his name that sat on him was Death, and Hell followed with him. And power was given unto them over the fourth part of the earth, to kill with sword, and with hunger, and with death, and with the beasts of the earth.Revelation 6:7-8 (King James Version)
For that arch thing maybe a bit extension could do it:
Create a struct for commands, storing the command index itself and the parameters needed by the command. It could look like this in code:
struct command{ int command; std::vector<void*> data;};
And the command list would consist of pointers to commands. By the way, I prefer vectors, because they are nearly ten times faster than lists, and they can do the same.

Take a look over articles, I saw some useful ones.
Advertisement
After I get the collsion system working the way I want it too, I'll optimize the code. Thank you for that detail about vector.

I was doing this so I'm correct with my ideal.
I have another question, but it doesn't relate to this forum.
And it's not Math And Physics and it is kind of beginner-ish so it will be in 'For Beginners'.

-----------------------------I heard the voice of the fourth beast say, Come and see.And I looked, and behold a pale horse: and his name that sat on him was Death, and Hell followed with him. And power was given unto them over the fourth part of the earth, to kill with sword, and with hunger, and with death, and with the beasts of the earth.Revelation 6:7-8 (King James Version)

This topic is closed to new replies.

Advertisement