Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Game Not working

8 views
Skip to first unread message

Adam W

unread,
May 9, 2008, 1:11:36 AM5/9/08
to WSU-Assembly-Engrs
My game is finished and runs great, but when I loaded it onto the
gameboy the jump and shoot don't work correctly. It's weird because
sometimes it is and sometimes it isn't I don't know what's wrong!


http://wsu-assembly-engrs.googlegroups.com/web/Final%20Project-Adam%20Wiebe.zip?gda=i4QQL00AAAAScCZmhdp0z_wLL5mrqLwbQsZhGilKL7IvccvO0AmVJGG1qiJ7UbTIup-M2XPURDQpr_xvRKVY639QyV6DtxSIviiSJFrHJTP0CRH0THmrKg&gsc=4uvMzQsAAACVzMWWKqfjDINHQY6w6Otq

John Harrison

unread,
May 9, 2008, 8:34:50 AM5/9/08
to wsu-assem...@googlegroups.com
I played your game on a GameBoy color and what I witnessed is that at first there might be a random jump or random shot and then it seems to "settle down" and work correctly after 5 seconds or so. Is this an accurate read of what isn't working? If so, I suspect that the problem is that you are not initializing your flags before your game loop.

Be default, the emulator automatically loads uninitialized memory locations with 0 but a real GameBoy loads them with random values. So if you don't initialize all of your variables, their values are unpredictable. ProjectileFlags, for example, could be anything so your game might think it is already shooting a bullet etc. intially.

Here's what I would do:
  • in the emulator under options -> debugger setup change the setting "Initialize RAM" from "Zero Filled" to "Random Filled (as in reality).
  • run your program in the emulator and see if you see the same weird behavior you saw on a real Game Boy.
  • If you do see the same behavior, try setting all your variables to 0 in your initialization.
Let us know.

-John

Adam W

unread,
May 9, 2008, 10:02:42 AM5/9/08
to WSU-Assembly-Engrs
Yeah that's what it was. Thanks a bunch.

On May 9, 7:34 am, John Harrison <john.harri...@wichita.edu> wrote:
> I played your game on a GameBoy color and what I witnessed is that at
> first there might be a random jump or random shot and then it seems to
> "settle down" and work correctly after 5 seconds or so. Is this an
> accurate read of what isn't working? If so, I suspect that the problem
> is that you are not initializing your flags before your game loop.
>
> Be default, the emulator automatically loads uninitialized memory
> locations with 0 but a real GameBoy loads them with random values. So if
> you don't initialize all of your variables, their values are
> unpredictable. ProjectileFlags, for example, could be anything so your
> game might think it is already shooting a bullet etc. intially.
>
> Here's what I would do:
>
> * in the emulator under options -> debugger setup change the setting
> "Initialize RAM" from "Zero Filled" to "Random Filled (as in reality).
> * run your program in the emulator and see if you see the same weird
> behavior you saw on a real Game Boy.
> * If you do see the same behavior, try setting all your variables to
> 0 in your initialization.
>
> Let us know.
>
> -John
>
> Adam W wrote:
> > My game is finished and runs great, but when I loaded it onto the
> > gameboy the jump and shoot don't work correctly. It's weird because
> > sometimes it is and sometimes it isn't I don't know what's wrong!
>
> >http://wsu-assembly-engrs.googlegroups.com/web/Final%20Project-Adam%2...
>
> --
> John Harrisonhttp://alumni.media.mit.edu/~harrison

John Harrison

unread,
May 9, 2008, 10:52:21 AM5/9/08
to wsu-assem...@googlegroups.com
so your collision detection was purposefully disabled? Your game is going to be impossible when it is enabled if one hit actually kills you to hit one of the enemies. You could change so they have to be hit by an enemy 10, 20, 100 times. And/or  have the score decreased by some sort of amount when the enemies hit the hero. You could start the score at 1000 instead of 0 to avoid negative scores. You could also have the game be a specified amount of time and the player tries to get the highest score possible in that time by hitting as many as possible and avoiding being hit etc.

just some ideas. You probably have better ones....

Adam W

unread,
May 9, 2008, 4:41:45 PM5/9/08
to WSU-Assembly-Engrs
Here's what I am trying to do about that. I'm trying to have the hero
sprite get hit 3 times before he dies. I have an idea of how that
will work but I'm kinda stuck right now with getting it implemented,
any ideas?

Tyler Tyson

unread,
May 9, 2008, 4:46:58 PM5/9/08
to wsu-assem...@googlegroups.com
Similar idea/thought here, I was reading your post, where do you change the starting score counter to "other than" zero?  I can get it to increment and decrement in varying amounts, but couldn't see where to start the score at 1,000 as you mentioned.  ty

> Date: Fri, 9 May 2008 13:41:45 -0700
> From: aaw...@wichita.edu
> Subject: [wsu-assembly-engrs:433] Re: Game Not working
> To: wsu-assem...@googlegroups.com

John Harrison

unread,
May 9, 2008, 4:51:35 PM5/9/08
to wsu-assem...@googlegroups.com
keep a variable called Lives, initialize it to 3 before your main loop, and decrement it every time the hero is hit.  Also every time the hero is hit, check and see if it is 0. If it is...game over.

John Harrison

unread,
May 9, 2008, 4:55:51 PM5/9/08
to wsu-assem...@googlegroups.com
it's in the tutorial for easyScore.

Adam W

unread,
May 9, 2008, 5:31:06 PM5/9/08
to WSU-Assembly-Engrs
I'm having trouble setting up my variable, maybe I'm not sure how to
do that.

John Harrison

unread,
May 9, 2008, 5:58:03 PM5/9/08
to wsu-assem...@googlegroups.com
  • Look for your LoByteVars and add this one:
LoByteVar   lives
  • Just before your main loop, load it with 3:
ld   a,3
ld   [lives],a
  • where you have a collision with a hero add:
ld   a,[lives]
dec   a
ld   [lives],a
jr   z,GAME_OVER_PLAYER_1_YOU_LOST

Adam W

unread,
May 9, 2008, 6:14:40 PM5/9/08
to WSU-Assembly-Engrs
I tried that and the game just freezes on contact with the enemy.
It's getting kinda late though, I don't know if I'll get it working
but I would love to. Here's my updated file

http://groups.google.com/group/wsu-assembly-engrs/web/Final%20Project-Adam%20Wiebe.zip

On May 9, 4:58 pm, John Harrison <john.harri...@wichita.edu> wrote:
> * Look for your LoByteVars and add this one:
>
> LoByteVar lives
>
> * Just before your main loop, load it with 3:
>
> ld a,3
> ld [lives],a
>
> * where you have a collision with a hero add:

John Harrison

unread,
May 9, 2008, 6:54:44 PM5/9/08
to wsu-assem...@googlegroups.com
if you want to return, you must call not jump.

Change all of your jr c,Collision stuff to call c,Collision, starting in line 245

Also, so you don't have a leak when the game restarts, add a pop af in line 278 to get rid of the address stored in the call you are adding.
Reply all
Reply to author
Forward
0 new messages