Recent

Author Topic: Castle Game Engine (Cross Platform) - Need Help with Drawing a Raycast Vector  (Read 12903 times)

cdbc

  • Hero Member
  • *****
  • Posts: 1499
    • http://www.cdbc.dk
Hi
I have no interest in games, will not be installing anything... I'm only looking at your code, because you asked for help...
...and maybe I'm able to point out, the fact that your code 'as is' might not behave the way you think...
Oh, try and put your cursor on one of the lines between 60 & 77 and then press (Ctrl+Shift) + c and see what the codetools do?!?
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
A: *facepalm* I specifically stated that the code only works if you have Castle Game Engine installed and know its coding rules, and isn't just generic Pascal, because for example it has hard coded sections of "uses", "implementation", etc that just don't work the same way in a generic Pascal compiler.

B: How is that so? If I read the directions properly and follow the official examples given, shouldn't you expect it to work without a hitch?

C: I can do that, and again thank you for giving help to the best of your ability as always!

cdbc

  • Hero Member
  • *****
  • Posts: 1499
    • http://www.cdbc.dk
Hi
A) It's still just a framework, like every other complex framework and pascal code. I just need to see your code, no compilation necessary.
B) You yourself stated, that you've made changes to the example...
C) You're welcome
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Oh yeah, your points A and B make more sense now, and I am really sorry for misunderstanding.

Please refer to posts I made in the previous page, where you can find the full fixed code.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Again, I still stand by the "if SandyAirborne := 0" actually being necessary for the code to work, just like "the if SandyIdle := 0" is necessary for the code to work for exactly the same reason; namely that if you don't check those conditions the code will execute forever in a repeated loop each frame, and the game will lag to a crawl.

cdbc

  • Hero Member
  • *****
  • Posts: 1499
    • http://www.cdbc.dk
Hi
I understand the dynamics / mechanics of it, more the reason to have things in their right place, pascal/code/techniques -wise.
And while I'm at it, your formatting needs some TLC, I believe Michalis showed you how  ;)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
I thought I did the formatting properly in the last piece of code, judging by the examples and how Michaelis told me to do it; IE indenting blocks nested inside blocks, whereas that wasn't true with my older code.

All the rest of the code was already formatted in the way it appears now, again going by the way the procedures were initially defined with a specific number of spaces before them, or how the system files directly under the "uses" header already had a specific number of spaces before them, and so on; it would be weird if it had to be formatted differently than the developers themselves formatted it.

cdbc

  • Hero Member
  • *****
  • Posts: 1499
    • http://www.cdbc.dk
Hi
Well, it has gotten better during our acquaintance  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
LOL! More seriously though, are there any other errors you think need fixing?

Again, everything besides the big block where I had to indent the lines further, was typed in its particular way because it was already like that in the original example, as pointed out earlier. I am not sure if there is just something else I am missing, but if there was I would think the compiler would point it out to me.

And again, it's just weird that the procedure declarations are an error now as pointed out earlier, even though they worked perfectly exactly as they were, as I never modified those particular lines of code, ever.

cdbc

  • Hero Member
  • *****
  • Posts: 1499
    • http://www.cdbc.dk
Hi
Hmmm, have you changed the name of /any/ type? that could be it?!?  %)
Did you try ctrl-shift-c?
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Oh yeah, I didn't do CTRL SHIFT C because I am not on my home computer, but will definitely do that later, and no, I didn't change the names of the type because I thought they should work fine if they worked fine earlier without any changes, and I still stand by that, but if that is indeed what I have to do what should I change the names of the type to?

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
And again, I know from looking at a lot of the examples that come with the game engine they usually don't have periods before the function declarations like I added, but the compiler just wouldn't accept it and would treat it as a missing period error when I didn't include them, so I was forced to do so to continue.

Does anyone know a good workaround so that the procedures are read and work properly, while still including the periods where they are?

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Is perhaps changing the name of them the workaround?

Again, none of this makes any sense to someone without any insider knowledge of Pascal and who just reads the manual going by how exactly it states things should be typed, like me, but I suppose I can just memorize this is one of those times where there is a slight change to a very specific rule.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
And I know also to not get too ahead of myself - just take things one step at a time and try the CTRL C trick mentioned earlier, then worry about what I should do after that.

cdbc

  • Hero Member
  • *****
  • Posts: 1499
    • http://www.cdbc.dk
CTRL + SHIFT + C
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018