Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Enemy hit after a certain amount of time !help!

Author
Message
Blackout1471
12
Years of Service
User Offline
Joined: 21st Dec 2011
Location: Visual C++ Express
Posted: 30th Dec 2011 12:24
when my player make collision with the enemy the enemy kill me in one blow i wan't the enemy only to hit after every second?

here is my code:


Beginner In the Language.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 30th Dec 2011 14:43
put "int time" in a greater scope, could be global, or a member of your class or something, then your code should be like:


Blackout1471
12
Years of Service
User Offline
Joined: 21st Dec 2011
Location: Visual C++ Express
Posted: 30th Dec 2011 15:38 Edited at: 30th Dec 2011 15:40
it says
Quote: "1>c:\users\*\documents\visual studio 2008\projects\fighter\fighter\player.cpp(20) : error C2296: '+' : illegal, left operand has type 'time_t (__cdecl *)(time_t *)'
"


and my code looks like


Beginner In the Language.
vitinho444
14
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 30th Dec 2011 18:09
you could use the simplest function to time:

First include time:


Then when the collision happens put this:




Then for the actual attack (to remove HP)

use:



Hope it works, i never used it like that, but i might.

C++ Medium 3.5/5
www.oryzhon.com <-- My company's website (W.I.P)
Blackout1471
12
Years of Service
User Offline
Joined: 21st Dec 2011
Location: Visual C++ Express
Posted: 30th Dec 2011 20:05
Sry i don't quite understand.

Beginner In the Language.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 30th Dec 2011 20:13 Edited at: 30th Dec 2011 20:14
um not quite sure, try something other than "time", could be used somewhere else or something
EDIT: yeah, the word "time" is already used in this

Blackout1471
12
Years of Service
User Offline
Joined: 21st Dec 2011
Location: Visual C++ Express
Posted: 30th Dec 2011 20:44
Thanks that did it code to all the other:


Beginner In the Language.

Login to post a reply

Server time is: 2024-11-19 05:18:41
Your offset time is: 2024-11-19 05:18:41