2,321 Forum Posts by "Musician"
I’m still working on new ways to improve my tile based engine, so I've been working hard to find ways of doing things tile based that I already know how to do art based. If you know much about tiles then you know that they are created using arrays.
Well right now I'm using a 3-dimensional array to set up my map and every tile is represented by a number (1 2 3 ect...). I want each of these tiles to have different properties and variables, so I’ve been looking into ways to do such.
After thinking a bit, I remembered that I heard something about objects being things that hold code, and pointers being an address that can stream an instance of that code. I was wondering if there is any way to set the behavior of each of my tiles by building an object for each kind.
I'm sort of new to pointers and I don’t know if flash can even use them so any help would be appreciated. And on a side note I'd like to say that I'll want to have static code inside of my tiles (code that’s only checked once), AND updated code (code that’s checked every frame).
At 9/3/05 09:46 AM, -ArcticHigh- wrote: how stupid were you when you first got flash? i remember the first flash i made was a zelda sprite flash and i didnt know you could use FRAMES so i madde 365 SCENES and moved the sprite a little bit each scene. you dont know how long and pointless that was.
wow you were fucking dumb! haha j/k I believe one of my first questions was
"OMG! HOW DO AYE ROOT THINGS TO TEH MAIN TIMELINE???!?!?!!?!ZOMG!!"
hitTest sucks... see the result of tile based!
At 9/3/05 09:05 AM, -ArcticHigh- wrote:
really! how fucking rich is that dude?! he has enough money to pay for 400 dollars and a psp just cuz someone made a game? he must be a fucking....rich......guy....
I don't think inglor owns games of gondor. He's just like it's ultimate bitch.
sorry inglor
HAHA [ESC]if??? that's fucking ironic
haha I can't believe this topic is still alive. actually man its really all about what you think. do whatever suits you but im telling you that your collisions will never get as good as this with hitTest.
http://img400.images..ge=tileengine1ps.swf
arrow keys to move...
not to mention faster speed, lower file size, and if you dont believe mapbuilding is easier then check out how much I changed it. I did that all in like 10 minutes. Believe what you want but tiles pwns hitTest 100 times over and I've just provided the proof :).
At 9/2/05 04:23 PM, SgtShooter wrote: Link don't work.
it does for me, try copy and pasting into the adress bar
go here and see the sigs these guys are making, I used to hang out there and make sigs before I started programming, but since I left the people have doubled over in skill.
http://randomchu.com/studio54/index.php
if you doubt me then check out the graphic showoff forum.
http://img352.images..ge=tileengine0qa.swf
I know I said I was done, but I got the last bugs ironed out so I thought I should post the link so that all the hitTesters can see its glory.
no, its still glitching bummer. anyways im sure I can figure this one out on my own. thanx for all the help.
laters
At 9/2/05 06:21 AM, BleeBlap wrote: In hindsight I realize my response to part 2 might not have made a whole lot of sense. This is the code I think you should try if your registration points are in the top left. If they aren't then you can pretty much ignore my last two posts because I'm on the wrong track.
I understood it the first time, thanx again.
Wow that was some brilliant logic ther bleeblap, it works much better. But I still do not fully understand why it works. but I'm guessing it's the same reason that I have to subtract the full width from the other sides.
update: http://img381.images..ge=tileengine8np.swf
but it still glitches when it hits the roof. however the invisible tiles are gone...which turned out not to be invisible tiles I guess :P
At 9/2/05 05:36 AM, BleeBlap wrote:At 9/2/05 05:03 AM, MusicianEXE wrote: I want a level of glitch free that hitTest can't handle.And would that level of glitch free be something like this?: Link
Nope better, your square sometimes sank into the boxes and other times hovered over them. You seem like a fairly experienced scripter though, do you see whats wrong with my script.?
It would be nice, to get like, help for once rather than a suggestion, The idea is finish this. It's me seeing how a tile engine works so I can start using them, I dont want to be told an easier way, I want debug help.
At 9/2/05 05:32 AM, WaterBottleClock wrote: If you wanna make tile based game,you could just download one of Tonypa's type of Tile game(Isometric,normal,etc)and change the MC's and such into your own stuff.
O.O you did not just say that... what the hell would I gain from doing that? I don't understand the reasons for half the things she does in that tute, not to mention it's for flash five. Copying and pasting is for n00bs.
hehe
for some reason when I subtract 3 from the left and down position codes they work better
but I use the term better lightly.
object.downY = Math.floor((y+object._height)/tileH);
object.upY = Math.floor((y-(object._height-3))/tileH);
object.rightX = Math.floor((x+object._width)/tileW);
object.leftX = Math.floor((x-(object._width-3))/tileW);
new example: http://img376.images..ge=tileengine2pa.swf
the square like leaps into position which is bad because I want it less jumpy. and sometimes it just freezes up and the square just sorta...squirms. and there are still those damned invisible tiles.
At 9/2/05 05:04 AM, Thomas2005 wrote: Lol,I think he used Ponyta or whatever the hell his name is tutorial....
Check your Array field thing or whatever for setting the tiles.Probably works better in Flash 5 if you don't have.
yeah Tonypa's, I actually only read his tutorial. I did all this coding on my own. Its not the same that she did, so it should be more suited for flashMX. but I can't seem to find the other glitches. its something to do with left and up collisions...
At 9/2/05 04:58 AM, GooGum wrote:At 9/2/05 03:58 AM, MusicianEXE wrote:HitTest is easier and works just as well when used properly.At 9/2/05 03:52 AM, cybex wrote: hitTest is so much easier! Why not use that?because hitTest sucks and this is actually much easier once you've completed the engine,
Pwn'ing Example
it is easier, but it doesn't match that of tile based collisions. If you like hitTest its fine with me. But I want a level of glitch free that hitTest can't handle. Granted this code is glitchy right now, but it shows promise if I can hunt out the last few glitches.
Not to mention in makes mapbuilding insanely easier.
At 9/2/05 04:15 AM, Rantzien wrote: The only possible wrong I could find was these parts:
object._x = object.rightX-(object._width/2+tileW/2);
Tried changing that into something completely different? The "teleportation" seemed to happen mostly when you didn't have anything beside you, but diagonally.
If that doesn't work, all advice I can give is to trace, trace and trace again. But you probably already did that =P
actually man your close, I found the source of the first glitch, it seems I forgot to return the grid based code to an x coordinate
(object.rightX * tileW)
like that in the moveObject function. thanks for the help anyhow. the teleporting problem is solved. Now I've gotta figure out whats causing the slides and invisible tiles.
heres an updated swf
http://img365.images..ge=tileengine3xy.swf
you'll notice the improvent of collisions when moving right, and moving down. Moving up and left is still glitchy.
At 9/2/05 03:52 AM, cybex wrote: hitTest is so much easier! Why not use that?
because hitTest sucks and this is actually much easier once you've completed the engine,
I tried to rewrite this code entirely 3 times with no luck. this is really shitty, if anyone knows the problem please tell me.
btw just so you guys know, I dont intend to make this a big project, I just want to get familiar with the tile based method, so I can use it when I need to.
At 9/2/05 02:26 AM, Deathcon7 wrote: The problem is, you don't even understand the code yourself, yet you're trying to use it. Try to work on a more basic level and work your way up. I would help you, but it would only be to leave you with more questions, and fuck that, I'm not the answerman. So, i know it's disheartening, in effect you should just push the project aside and work on more beginner projects.
I understand what I'm doing. I didn't copy and paste this code if your thinking it's because the old code was from flash five. I'm an accomplished actionscripter, I just see tiles as an easier way to do collisions and map building. I know what I'm doing in math an suck but I don't know what I've wrong here. You shouldn't make an assumption that I'm a begginer, I know my own limits.
At 9/2/05 02:07 AM, neobyte1 wrote: Try to learn the tonypas tutorials. Just write in google:
Tile based game tutorials and when you find tonypas tutes everything is gonna get easy then.
actually I'm using that tutorial right now. I just redid the code entirely and now it doesn't even work. I'm starting to get pissed.
yeah...for some reason my engine isn't working. I can't seem to locate the source of the the glitch.
http://img363.images..ge=tileengine4nr.swf
use the arrow keys(you can only move one way at a time.)
Theres the SWF so you can visually see the glitches. The first is obvious, when you hit a block while moving down or right and your inside the box then you jump to the outside of the box thats the opposite direction that you are going. secondly the left and up collisions just like shoot you somewhere else. Finally, I also noticed that when you get shot to the outside of the area and you go all the way down or all the way to the right the theres seems to be an extra layer of collision data that is invisible.
It might be something really obvious that I'm missing thats causing this, but I cant seem to find it. I hope someone here can help me with my problem.
THE SOURCE CODE
This Code is in a layer called actionscript
_root.createEmptyMovieClip("tiles", d++);
_root.tiles._y+=100
_root.tiles._x+=100
myMap = [ [1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 0, 1, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 0, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1]];
charPos = [2, 4];
tileH = 30;
tileW = 30;
Kright = Key.RIGHT;
Kleft = Key.LEFT;
Kup = Key.UP;
Kdown = Key.DOWN;
d = 0;
buildMap(myMap);
_root.onEnterFrame = function() {
moveChar();
};
This Code is in a layer called functions
function buildMap(map) {
mapH = map.length;
mapW = map[0].length;
for (i=0; i<mapH; i++) {
for (j=0; j<mapW; j++) {
_root.tiles.attachMovie("tile", "tile_"+i+"_"+j, d++);
_root.tiles["tile_"+i+"_"+j]._y = (tileH*i);
_root.tiles["tile_"+i+"_"+j]._x = (tileW*j);
_root.tiles["tile_"+i+"_"+j].gotoAndStop(m
ap[i][j]+1);
if (i == charPos[0] && j == charPos[1]) {
_root.tiles.attachMovie("char", "char", d++);
_root.tiles.char._y = tileH*i;
_root.tiles.char._x = tileW*j;
}
}
}
}
function getCorners(y, x, object) {
object.downY = Math.floor((y+object._height-1)/tileH);
object.upY = Math.floor((y-object._height)/tileH);
object.rightX = Math.floor((x+object._width-1)/tileW);
object.leftX = Math.floor((x-object._width)/tileW);
if (myMap[object.upY][object.leftX] == 1) {
object.upleft = true;
} else {
object.upleft = false;
}
if (myMap[object.upY][object.rightX] == 1) {
object.upright = true;
} else {
object.upright = false;
}
if (myMap[object.downY][object.leftX] == 1) {
object.downleft = true;
} else {
object.downleft = false;
}
if (myMap[object.downY][object.rightX] == 1) {
object.downright = true;
} else {
object.downright = false;
}
}
function moveObject(dir, object, speed) {
if (dir == "right") {
getCorners(object._y, object._x+speed, object);
if (object.downright == false && object.upright == false) {
object._x += speed;
} else {
object._x = object.rightX-(object._width/2+tileW/2);
}
} else if (dir == "left") {
getCorners(object._y, object._x-speed, object);
if (object.downleft == false && object.upleft == false) {
object._x -= speed;
} else {
object._x = object.leftX+(object._width/2+tileW/2);
}
} else if (dir == "up") {
getCorners(object._y-speed, object._x, object);
if (object.upright == false && object.upleft == false) {
object._y -= speed;
} else {
object._y = object.upY+(object._height/2+tileH/2);
}
} else if (dir == "down") {
getCorners(object._y+speed, object._x, object);
if (object.downright == false && object.downleft == false) {
object._y += speed;
} else {
object._y = object.downY-(object._height/2+tileH/2);
}
}
}
function moveChar() {
if (Key.isDown(Kright)) {
moveObject("right", _root.tiles.char, 5);
} else if (Key.isDown(Kleft)) {
moveObject("left", _root.tiles.char, 5);
} else if (Key.isDown(Kup)) {
moveObject("up", _root.tiles.char, 5);
} else if (Key.isDown(Kdown)) {
moveObject("down", _root.tiles.char, 5);
}
}
thanks again any help appreciated, Ill answer any questions if the source is confusing in one way or another.
I dont really know what XML is, but from what I know it can be used to database games... so I would think so but more research would be needed.
im not sure exactly what the other guy said but I would try and make a for statement to place hexagons at different places using an array and some code to change the start of the hexagon line after each one was finished. your attempting something very hard hear so I wish you the best of luck. But I wouldn't touch shit like this with a 20 ft pole.
nice work man, I dunno alot of the controls but I can tell that you've put effort into it. you should make the collisions with the circles using thier radius and the rotation of the gun. I dunno how to explain it better actually but anyways, keep up the good work.
nono I wasn't implying that THEY used API, im saying that how it would have to be done in flash.
At 9/1/05 03:41 PM, fwe wrote: Sincerely, fuck off
virgin
chill out man, im really trying not to look like a flammer. honestly, i'm really not trying to make a fuss im just trying to point out the things that make his request riddiculous. Im sorry I offended you but sheesh, I'll stop posting if I look bad for saying this, but my only intention was to save people the trouble of joining something that doesn't exist.
laters
Hey I've been playing arround with arrays for the first time and I've found them quite useful for storing data. Naturally I've also been playing around with the tile based method of mapbuilding.
http://newgrounds.co../topic.php?id=337148
But it occured to me the other day that you could make a drawing pixel by pixel in code by using an array mixed with API. So my question is, do you think they did this back when nintendo was still doing all those 8-bit games? Naturally you could make a code generator to do most the work for you but just imagine the amazing control you can have over collisions if he was drawn pixel by pixel in code.
Hell you could make it so that he recieved more damage from being hit on different colors or places. or make precise spots from which to generate things. The implications are nearly endless. I know that the same thing can apply with API objects but still not nearly as much as an object of pure blocks.
Anyways now im ranting but I encourage anyone interested to check out arrays if you haven't already, you can find some nice tile based tutorials at oos.moxiecode.com.
laters

