Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / ScouseKnight's Pacman tutorial help :)

Author
Message
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 17th Mar 2005 04:55
Hi the I'm following the very good Pacman tutorial by ScouseKnight and am having a bit of problem when I move my Pacman to the openings on each side of the screen. Instead of Pacman re-appearing on the other side of the screen I get an error message saying "Runtime error 118 - Array does not exist or array subscript out of bound at line 60" Now I am guessing that this is because my map array has no data for the wall collision to read, but have checked the forum on the tutorial thread and nobody else seems to mention it. Any help? Heres the code:



This is all like AMOS on the Amiga!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 18th Mar 2005 04:37
Hmmmm, any help out there???

This is all like AMOS on the Amiga!
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 21st Mar 2005 20:26
You are, infact, trying to access an array value that doesn't exist.

Let's say your centrex is at 16 ( putting you in the "hole" in the wall ), and you check for value centrex+1 ( at line 60 ), then you're checking for a value that is outside of the bounds of the array.

What you need is a simple check in there, before you actually check the array. Something along the lines of;

Then change the array check to correspond to those new values;


That should fix you up

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 22nd Mar 2005 04:21
Hi there Jess, thanks for a reply. Just tried your idea and it works a treat!
Thought it was to do with no value in the array or outside of it should I say, but wasn't sure as it said nothing in the tutorial and nobody else has mentioned it which is strange????

Thanks for the help though, the DBPro forums are still very helpfull, or should that be the people in it! Heres the new code if anyone needs it in following the tutorial.



This is all like AMOS on the Amiga!
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 22nd Mar 2005 06:34
Anytime, mate. Glad to help

Maybe when you followed the tutorial ( I haven't looked at it myself ), you skipped a little bit of code that did the check, or maybe put things a little out of order in your source?
I'm just guessing, but they're my best bet's as to why noone else has mentioned it.

Keep up the good work
I'll expect to see a 3D app as good as Colour Splash in no time!

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
SpecTre1
23
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 25th Mar 2005 07:57

Something in 3D will be on the way soon!!
Not sure what yet but gota make a start eh?!

Thanks again m8y!

This is all like AMOS on the Amiga!

Login to post a reply

Server time is: 2026-07-14 00:28:22
Your offset time is: 2026-07-14 00:28:22