forums

TNT Basic Forums > Programming Q&A
some platformer questions...
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-26-2005 20:34

Posted by:
Ian

Location:
canada

Find more posts by Ian

alright, is there a way to make a tile not square? or have patches where a backgorund could show through? this is using the map editor of course. im trying to make a platformer, and i want a background to scroll by. i think ive figured that out well enough, just display a picture behind the map and the scrolling is simple. its the terrain im lost on. lets face it, in a platformer your not going to have everything buit up by squares so much, your going to have slopes, uneven ground, round things and such. im wondering if you can make it so that a portion of a tile has a "see through" color almost. like a color that wont show up when the game is run so that, say, only half the tile is shown and the rest is invisable, and you can see the background through it.

im not sure any of that made sense... but if it did, and if you can shed some light, please do.

also, for my jump command, i have it set to a "key press" command, but that makes it so that if you dont hold jump the whole time, he simply drops. the only way to make the character make the full jump is to hold down the jump button the entire extent of the jump and fall... is rather irritating. basically what im saying is, ive noticed thatt my current process only works while the key is held down. i want a way to make the whole jump no matter how long the key is held, be it a mere tap or quite some time.

once again if it doesnt make sense, im sorry, im not sure how to explain it all.

thanks!

Ian

07-27-2005 00:08

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Platform problems...

I'm not near my Mac at the moment, so I'll have to wing this a bit, but have you tried using an image format that supports transparency or alpha, say '*.gif' or '*.png'?

Even with transparent pixels, you may get the visual effect but coding the collision detection would be a nightmare unless you treat each block or tile as a separate entity, or entity type (for example 'end of platform' or '45 degree slope left' etc.). You need to be able to poll the 'A' (alpha) part of an RGBA pixel, and again I'm not near a Mac for a while so I can't check for definate, but I'm 99% sure that you can't do this with TNT (at the moment!). You can only build a map from a single image file, and not from sprites or a specified sprite bank (something of an ommission I think, but one that could easily be corrected!), and again I don't believe you can set the transparency of an individual image.

Of course you could always use 'Objects' to represent the problem tiles, poll for their presence in your loop and place sprites at the relevant positions. It's a bodge but it does solve the immediate problem.

With regard to the jump code, I would suggest (without seeing your code) that you are doing it the wrong way. Create a 'jumpStatus' variable and set it to 0 by default. If the 'jump button' is pressed, set jumpStatus to 1. If jumpStatus > 0 do your jump code (until it completes, then reset) skipping the check for a jump button. If your jump is of a fixed size the easiest way to deal with it is to create a multi-dimensional array of xOffset, yOffset, image, and use jumpStatus as the index (though three separate arrays are faster). If the character can fall further than the end of the array index (for example they wont always end up at the same Y coordinate that they started at) you will need to do collision detection 'en-route' and continue 'falling' (last array index offset) until they hit 'the ground'. If jumpStatus is 0 then just check for the jump button and set jumpStatus to 1 if it's true...

Hope this helps, and all the best with the game!

Danny (Nods)

07-31-2005 06:59

Posted by:
Wil Hostman

Find more posts by Wil Hostman

Jump Issue

better jump method, or at least "Looks" better

add a jump Vector variable. (JV)

set an in-air flag variable to true, (fIA) and give JV some arbitrary value.

Each frame,

if pressed(gJumpKey)
if fIA == False then JV=10 else JV +=1
fIA == True
end if

if fIA == true
spriteVertLoc += JV
if fIA == True then JV -= 2
end if

and in you collision code
for a top collision: set JV to 0, leave fIA alone.
For a Bottom collision, Set fIA to false, and JV to 0.

this process makes it so that a held button is a longer jump than a short one.

the JV -= 1 is the gravity resist code. It's the "Not tucking for maximum falling speed" the -1 is replaced by whatever your feel is right.

The JV -= 2 is you "Gravity" rate. If not higher than the resist, one can float. If less than gravity resist, fly.

If you don't check for in-air before the initial burst, you get TURBO Boost

You can also add additional code for, say, crouching before a jump.

if pressed(gJumpKey)
LV = 10
if fCrouch then LV += 5
if fRocketShoes
LV += 5
GR = 2
else
GR = 1
end if
if fIA == False then JV= LV else JV += GR
fIA == True
end if

07-31-2005 13:48

Posted by:
DanLurie

Location:
Earth>USA>New Jersey>Clifton>My Chair

Click Here to Email DanLurie   Find more posts by DanLurie

Read this:

http://www.geocities.com/siliconvalley/campus/9449/physics.htm

08-03-2005 00:49

Posted by:
Ian

Location:
canada

Find more posts by Ian

Thanks a ton guys, your really helped alot. i appreciate it!

Ian

08-03-2005 21:27

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

You're Welcome!

Always glad to help, any more problems just drop us a line and someone will offer an answer...

All the best with the project.

Danny (nods)

08-12-2005 21:00

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

As for the transparent scrolling thing, there is no direct support for parallax scrolling in TNT Basic currently. One way to implement it would be to draw each tile as a sprite. You could do this by using the 'copy image' command to copy a section of your tile image into a sprite bank then use the 'map tile' command to read what tile is at a position in your map and draw a sprite at that position with the image specified. You can move all the sprites using the MOAN set of commands, eg put all sprites that represent one layer into a single MOAN channel and move then channel to move the entire parallax layer.

This will work for small maps but will become less effcient for larger maps as it will be processing a lot of sprites that aren't visible. So an extension to this method is to constantly monitor which section of the map can be seen and turn off any sprites that aren't currently visible.

I'm sure I posted an example showing something like this at some point, maybe someone can remember/find it because I can't!

Mark

08-12-2005 21:55

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Welcome Back?

Hi Mark, there was a parallax example in the directory, but the link is 404...

Danny (Nods)

08-12-2005 22:33

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

yeah i was the one who did the parallax example... dunno what happened to the website, that's what happens with free accounts i guess :P though it's not hard to make at all, it's just to reproduce the standard map drawing routines, to determine what tiles are visible from the location where you,re at, then determine their location and draw them as sprites

08-12-2005 22:43

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

i found the examples on my computer... they're back at:

http://tntfiles.site.voila.fr/

08-13-2005 08:03

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Cheers Matthew!

Are we good or what!

Danny (nods)

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.