[SFML] Breakout Help :(

Started by
15 comments, last by superman3275 11 years, 6 months ago
Look at my code, look at your code, now look back at my code, and back at your code......

I do Block* pBlocks !!
Not Block* pBlocks[[[[[[[[....]]]]]]]] smile.png
Advertisement
This is my error code now:
1>------ Build started: Project: BREAKOUT, Configuration: Debug Win32 ------
1> stdafx.cpp
1> Ball.cpp
1>c:\users om\documents\visual studio 2010\projects\breakout\ball.cpp(38): error C2065: 'Blocks' : undeclared identifier
1>c:\users om\documents\visual studio 2010\projects\breakout\ball.cpp(38): error C2228: left of '.GetCollision' must have class/struct/union
1>c:\users om\documents\visual studio 2010\projects\breakout\ball.cpp(38): error C2065: 'Blocks' : undeclared identifier
1>c:\users om\documents\visual studio 2010\projects\breakout\ball.cpp(38): error C2228: left of '.GetIsHit' must have class/struct/union
1>c:\users om\documents\visual studio 2010\projects\breakout\ball.cpp(41): error C2065: 'Blocks' : undeclared identifier
1>c:\users om\documents\visual studio 2010\projects\breakout\ball.cpp(41): error C2228: left of '.SetIsHit' must have class/struct/union
1> BREAKOUT.cpp
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(29): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(29): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(34): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(34): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(39): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(39): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(43): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1>c:\users om\documents\visual studio 2010\projects\breakout\breakout.cpp(43): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
1> Generating Code...
1> Skipping... (no relevant changes detected)
1> Paddle.cpp
1> Block.cpp
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
(Ignore the conversion problems, that's not a real bug it happens for a reason!)

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

I fixed it so those errors aren't happening, but now it gives me the same 0xccccccd0 exception error?

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

Dang, I'm so glad I wrote some error code that prints out if the block I'm printing on is uninitialized. I was acting on a block that was uninitialized. Now to figure it out.

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

Do you know why this happens? Because you are thinking I'm going to handle over all the code..

Block* pBlocks, you can clearly see a ' * ' in my code.
This is a dereference. Or in other words, this is a pointer. It stores an address of an object it's location.

http://www.cplusplus...orial/pointers/

I found 2 errors, I can't find any error at the moment. Try using break points. Put some breakpoints in your main functions and go over the methods one by one. When you get the break error after jumping over a method, it means you are doing some strange stuff inside that method.


~EngineProgrammer
Okay, the problem was that I was starting at Blocks[20], which meant that it was not calling the function correctly, and luckily I TOLD it to print out an error message if I did that, but I just forgot about it. #facepalm

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

I fixed it, I'm sorry I tried to do that, but it didn't work because that wasn't the problem. Sorry.
EDIT: I don't understand why I didn't just make the array of blocks member variables of the ball class, considering the ball was going to be the only other object interacting with them. My next goal: Change the code to make the Block array part of the ball class.

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !

This topic is closed to new replies.

Advertisement