June 19, 2019, 01:07:03 pm

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Help with HGE

Started by JosephE, December 02, 2009, 06:59:36 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JosephE

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

fasecero

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!

JosephE

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.

LarryMc

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

JosephE

Thanks Larry. I've adopted the prefix variable declaration and immediate value assignment for my programming in EB, like you posted. :)