123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|467|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> help with a code please

Fri, 11 May 2012, 16:14
daniel11111112
simple tilemap and character script this is the game i was working on could someone help me with a problem that came up while i was testing if i move to the edge of the map the map stops moveing but the character keeps going as its meant to but if i try to move away from the edge the character stays in the same place on the screen (youll see what i mean when you test it)
Fri, 11 May 2012, 19:22
steve_ancell
I'm getting a Memory Access Violation (MAV) when I run it, in debug mode it shows an Array Index Out Of Bounds. Don't know if you already knew this arrays in Blitz3D start at zero.

I will have a look at the code and see what I can do.
Fri, 11 May 2012, 19:30
steve_ancell
Another tip:

Just above where your Data commands start, give it a name so that you can use the Restore command to select each level you make for, to name a Data block you would use a decimal point followed by a name, for example...

.Map1
Data 12345
And any other lines of Data commands that go in this level.

.Map2
And all the Data commands that make that level.
Fri, 11 May 2012, 21:10
steve_ancell
Actually, it may be easier if I just pop over at the weekend and go through a few things with you.
Fri, 11 May 2012, 21:45
steve_ancell
Right!, I've managed to get the code running without MAVing out, I can now see what is happening and I will rip it apart tomorrow.
Fri, 11 May 2012, 21:48
steve_ancell
You also forgot to include graphics for the character so I modified it to work temporarily without that particular sprite.


Sat, 12 May 2012, 08:46
daniel11111112
ok :3 sorry for the late response i just got back onto socoder i was playing with my freinds online yesterday also everything works my end i dunno whats wrong... did you add the pictures into the same place as the code?
Sun, 13 May 2012, 08:07
Afr0
First of all:
This isn't a "script". This is a "program". A "script" is external code run by a program. Now, interpreted languages like C# and Java are run by a VM (Virtual Machine), but C# is JIT-compiled (Just In Time) when a program is run for the first time, meaning that C# is less of a scripting language than Java.

Secondly:
Don't use the Data command. At least not if you intend to make this in to a game. The Data command increases the size of your executable unnecessarily and makes your code longer than it has to be. Not to mention the fact that it requires you to recompile your program every time you update a tile-map. And the Blitz compiler is slow as-is, so if you have a million lines of code, that's not what you want to be doing.
Learn about file IO! The only argument I could see for using the Data command would be that it makes it harder to tamper with your tile-maps, but if you want to achieve that, you should learn about encryption instead. Or simply design a custom binary format used by your application that can hold many tile-maps at once. Heck, it doesn't even have to be very complicated. The Sims and The Sims Online uses FAR (File ARchive), which is basically a textbook example of an archiving format that doesn't use encryption or compression.
The specs are here, you should be able to riff on that quite easily if you've learned about file IO.

-=-=-
Afr0 Games

Project Dollhouse on Github - Please fork!
Sun, 13 May 2012, 11:40
steve_ancell
I'm going to give Daniel a crash course on file I/O when I visit next.

|edit| I also showed him what labels can be useful for when I was over there yesterday. |edit|