Author Topic: Help with HGE  (Read 2154 times)

0 Members and 1 Guest are viewing this topic.

Offline JosephE

  • Jr. Member
  • **
  • Posts: 52
Help with HGE
« on: December 02, 2009, 06:59:36 PM »
I've been happily learning how to use HGE, thanks to fasecero's excellent resources.

However, I'm stumped on this particular demo program I'm making. Basically I have some pictures of some planets and I'd like to pan them around using the arrow keys.

But for some reason, it does everything but render! I think. I'm not exactly sure what's causing the problem, but you can find the complete program with it's resources in the attached zip.

I'd be much obliged if anyone can help! I'm pretty sure it's something simple I might be missing.

Joseph

Offline fasecero

  • Sr. Member
  • ****
  • Posts: 275
  • I'm sorry for my English.
Re: Help with HGE
« Reply #1 on: December 04, 2009, 01:35:46 AM »
Hi, JosephE. In the Frame function you don't give an initial value to the offsets, therefore, they will have random content, so just add something like:

Code: [Select]
Int OffsetX, OffsetY
OffsetX=0 : OffsetY=0

happy coding!

Offline JosephE

  • Jr. Member
  • **
  • Posts: 52
Re: Help with HGE
« Reply #2 on: December 04, 2009, 08:45:52 AM »
Having done as you said, and tweaked a few things, everything works great!

Somehow I assumed that EBasic cleared a variable out when it gave it to you, although I knew in languages like C and whatnot it would be garbage. Not sure how I came to that conclusion, but it definitely wasn't right.

Thanks so much for tracking that down! ;D I don't that I would have ever figured that one out.

Offline LarryMc

  • Administrator
  • Hero Member
  • *****
  • Posts: 5989
  • 'All I like is finishing'
Re: Help with HGE
« Reply #3 on: December 04, 2009, 09:05:47 AM »
another way to init variables that I use all the time:

Code: [Select]
Int OffsetX=0, OffsetY=0
string a$=""

Larry

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Offline JosephE

  • Jr. Member
  • **
  • Posts: 52
Re: Help with HGE
« Reply #4 on: December 04, 2009, 11:07:42 AM »
Thanks Larry. I've adopted the prefix variable declaration and immediate value assignment for my programming in EB, like you posted. :)