Need Examples

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Need Examples

Post by XxWalKaxX » June 17th, 2012, 4:11 pm

Im currently working on my own game, and im just curious on how to make something. Lets say the game character starts with no weapon and as the game progresses the character collects a weapon off of the map. How would i go about setting the character so when he moves over the weapon, the said weapon is collected and then setting kbd functions for aiming and shooting. I dont have my own code to post yet for some feed back on where im effin up, but i will post something soon. So if anybody has any ideas the help would be much appreciated!!
What you call a bug...I call a new feature!

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Need Examples

Post by LuX » June 17th, 2012, 4:37 pm

Check out my shooting game : -)

At the bottom of this page Link there's the full project download. It doesn't have weapon picking but it's got ammo picking and different weapons, etc. ;)
ʕ •ᴥ•ʔ

User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Re: Need Examples

Post by XxWalKaxX » June 17th, 2012, 10:58 pm

cool thanx
What you call a bug...I call a new feature!

User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Re: Need Examples

Post by XxWalKaxX » June 17th, 2012, 11:09 pm

There is something else i was needing help w/ (well there are actually a lot of things but that is besides the point), is there a way to put a timer on a function? im going to give an example without posting a lot of code. i am modding chili's poo game(the one where you collect the yellow disc as a goal), and I've added a "shield". When you pick up the "shield" it activates a blue circle around the smiley face. How can make it to where after the "shield" is drawn it will only stay drawn for a set amount of time. Also what would I need to do to make it to when the poo comes into contact with the "shield" the poo is destroyed(disappears or anything to that nature). I know how to detect for poo/shield collision but once collision is detected i dont know how to destroy the evil evil poo. If you want me to post my code so far just let me know but im hoping this short explantion will suffice.
What you call a bug...I call a new feature!

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Need Examples

Post by LuX » June 18th, 2012, 12:09 am

What you want to do here is pretty simple. I'm sure you'll figure it out yourself.
Chili hasn't taught much about timers yet, so here's how a simple timer would look like, using the one from Timer:

Code: Select all

if (timer.GetTimeMilli() >= 1000) // Interval: 1000 msec, one second
{
    // Do stuff every time the timer "ticks"

    timer.StartWatch(); // Reset timer
}
For this to work you need to include "Timer.h" and make a timer object, in this case called simply "timer". There is prolly a better way, but this is how I did it...
ʕ •ᴥ•ʔ

User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Re: Need Examples

Post by XxWalKaxX » June 18th, 2012, 12:14 am

sweet stuff...really appreciate it lux
What you call a bug...I call a new feature!

User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Re: Need Examples

Post by XxWalKaxX » June 18th, 2012, 2:28 pm

it didntz work, i used the #include "Timer.h" in my Game.cpp and when i went to build solution i got errors saying, timer undeclared, StartWatch undeclared identifier....
What you call a bug...I call a new feature!

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Need Examples

Post by chili » June 18th, 2012, 3:12 pm

That's odd. You should post your cleaned solution.
Chili

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Need Examples

Post by LuX » June 18th, 2012, 3:15 pm

You need to make a timer object first. Just like you declare an int in Game.h, you need to declare "timer" first. Simply go to Game.h and under user variables, write "Timer timer;" Also make sure you put the include Timer to Game.h.

The code I gave isn't an "actual" timer provided, it's something I threw together to make a fake timer. There's probably a much better way to do a timer, but I think this is good enough for now at least.
ʕ •ᴥ•ʔ

User avatar
XxWalKaxX
Posts: 244
Joined: June 11th, 2012, 7:15 pm

Re: Need Examples

Post by XxWalKaxX » August 6th, 2012, 6:11 pm

ok ill try that and if that doesnt work ill post it
What you call a bug...I call a new feature!

Post Reply