1945 game

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4

47 Replies - 1790 Views - Last Post: 27 August 2018 - 09:06 PM Rate Topic: *---- 2 Votes

#31 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: 1945 game

Posted 25 August 2018 - 02:37 PM

One way is to start a clock variable. When you want the event to start get the current time, add how ever many units of time you want, and stash that in a variable. This would be the 'future' time you want things to stop at.

As the engine rolls over have an IF statement check if the current time is greater than or equal to that variable time... when it does do what ever... like kick off another animation.. clear variables.. etc.
Was This Post Helpful? 1
  • +
  • -

#32 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 26 August 2018 - 02:24 PM

well I have coded up according to post #31, am I on the right track?
void wait()
{
	clock_t start_time = clock();
	int time = 10;
	if (start_time >= time)
	{
	drawScene_collision_one(-7.5f, 10.0f);
	}
}


Was This Post Helpful? 0
  • +
  • -

#33 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: 1945 game

Posted 26 August 2018 - 05:23 PM

Does it run? Does it do what you intend? I'm not keen on doing what you could accomplish by a basic build/run command.
Was This Post Helpful? 1
  • +
  • -

#34 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 26 August 2018 - 06:04 PM

well it does run but it does not do what I want it to do. I still want it to draw the collision sprite then black out the sprite. it simply blacks out the sprite.
Was This Post Helpful? 0
  • +
  • -

#35 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12494
  • View blog
  • Posts: 45,629
  • Joined: 27-December 08

Re: 1945 game

Posted 26 August 2018 - 07:29 PM

So it looks like pbivens85 has been battling this issue since December... And again in June.
Was This Post Helpful? 0
  • +
  • -

#36 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 26 August 2018 - 07:38 PM

yes I know, but I really want to solve this problem.
Was This Post Helpful? 0
  • +
  • -

#37 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: 1945 game

Posted 26 August 2018 - 08:58 PM

Then think it out. Heck - a boolean would work.

IF bullet collides with ship THEN
   flip on boolean value
END IF

... 

IF boolean is true THEN
   draw collision
   save the current time plus 2 seconds.
END IF

... 

IF boolean true AND current time is greater than the saves time THEN
   clear collision
   set boolean to false
END IF 


Honestly, at this point, I would recommend getting over the hump of wanting to do what ever game engine you are writing and use an existing one.
Was This Post Helpful? 1
  • +
  • -

#38 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 27 August 2018 - 02:12 PM

well I am working on this problem for a college class I am taking, that is why I have not abandoned this project.
Was This Post Helpful? 0
  • +
  • -

#39 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: 1945 game

Posted 27 August 2018 - 02:15 PM

... and the class specifically called for you to cobble some GLUT game engine together, or did it ask to just 'create a game'?

Following that - have you even gotten a book on the topic?
Was This Post Helpful? 0
  • +
  • -

#40 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 27 August 2018 - 02:24 PM

my instructor wants me to use glut and to create a space invaders like plane game, I have read several books on opengl and am reading a book on c++.
Was This Post Helpful? 0
  • +
  • -

#41 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: 1945 game

Posted 27 August 2018 - 02:25 PM

Huh.. What books?
Was This Post Helpful? 0
  • +
  • -

#42 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 27 August 2018 - 02:28 PM

I have read opengl superbible and the opengl programming guide
Was This Post Helpful? 0
  • +
  • -

#43 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: 1945 game

Posted 27 August 2018 - 04:46 PM

well here is my code for post #37
void wait()
{
	clock_t start_time = clock() + 1;
	int time = 10;
	cout << start_time << endl;
	if (sprite == true)
	{
		clock_t start_time = clock() + 1;
		int time = 10;
		drawScene_collision_one(-7.5f, 10.0f);
	}
	if (sprite == true && start_time > time)
	{
		erase_sprite();
		sprite = false;
	}
}


is this correct?
Was This Post Helpful? 0
  • +
  • -

#44 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14693
  • View blog
  • Posts: 58,724
  • Joined: 12-June 08

Re: 1945 game

Posted 27 August 2018 - 04:58 PM

Again.. Does it work? Does it compile? *You* should be testing it.
Was This Post Helpful? 0
  • +
  • -

#45 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12494
  • View blog
  • Posts: 45,629
  • Joined: 27-December 08

Re: 1945 game

Posted 27 August 2018 - 05:52 PM

View Postpbivens85, on 27 August 2018 - 05:24 PM, said:

my instructor wants me to use glut and to create a space invaders like plane game


Uh, huh... You mean in the first week of the semester (read- syllabus week, where very little material is covered in class), the professor wants you to build the game you have been working on since May, 2015. And in over three years, you have not made any progress on your issue of collision detection.

At this point, I frankly think you want us to do the work for you. Clearly, you are not even remotely close to a point where you are able to successfully work on games, when you cannot (or perhaps, will not) even test your own code.
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4