forums

TNT Basic Forums > Programming Q&A
i need help
< Last Thread     Next Thread >
Author
Thread        Post A Reply

03-03-2007 03:57

Posted by:
edu_loni

Find more posts by edu_loni

hey... im kinda new in this programming stuff and i stil need a lot of practice... can anyone help me???
im trying to give a diferent animation and movement to a sprite when i press the arrow keys

03-04-2007 10:04

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

post what you've coded here and we 'll try to help you :)

03-04-2007 22:45

Posted by:
Tim

Location:
New Zealand

Find more posts by Tim

Animation and movement.

Hi,

If your using the Sprite 1,x,y,image to place your sprite your going to have to manually animate by changing the 'image' variable yourself.

If you want to use the Animate Sprite command you will need to use the Sprite Move command to move your sprite without stopping any animation. All you would need to do is set another Animate command when the play hits a different direction.

Something like,

int movex,movey,x,y
x=400
y=200
sprite 1,x,y,1
repeat
if right
animate sprite 1,1000,1,5 to 2,5 to 3,5
movex=1
end if
if left
animate sprite 1,1000,4,5 to 6,5 to 7,5
movex=-1
end if
' Collision Detection goes here.
x=x+movex
movex=0
move sprite 1,movex,y,3
draw frame
forever

Hope this gives you some insight. You should be able to add up and down in the same manner. This is how Tang is moved in my game. Also has the advantage of cleaner easier collision detection. All you have to do is check to see if your player has hit something, set movex=0 and it wont move, simple.

regards,
Tim

Tang Swim With the Fishies

03-05-2007 01:13

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

i have not checked in depth, but i see you are using moan

animate sprite 1,1000,4,5 to 6,5 to 7,5

AFAIK you must not call this every frame. Either call 'sprite' everyframe, updating the frame ID, either call the 'animate sprite' command only once and then let it go on its own

03-05-2007 01:14

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

x=x+movex
movex=0
move sprite 1,movex,y,3

Here you are combining both moan and regular calls. DSon't do this.

Either:

move sprite 1,movex,movey,??

Either:

x = x + movex
sprite 1,x,y,3

03-05-2007 02:20

Posted by:
Tim

Location:
New Zealand

Find more posts by Tim

??


I think you need to read my code again. Animate is only called once when required. The move sprite is a moan, I am not calling the sprite animate command every frame as you claim. This code works perfectly. You also misinterpreted the code, its very efficient and is recommend by some of the best Basic programmers around. Its very adaptable to collision detection and its side benefit is that its compatible with TNTs animation system.

If you are concerned at the MOVE command being called every frame, simple fix...

IF NOT MOVEX=0 THEN MOVE SPRITE 1,MOVEX,Y,5

This extra precaution doesn't appear to trouble the existing code.

Your suggestion of directly manipulating x and y is the reason animation fails. Every time you call SPRITE, it kills the ANIMATION. This is the problem he's eluding to if I'm not mistaken.

Tim.

03-05-2007 23:53

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

you're right i didn't read properly

05-12-2007 17:22

Posted by:
Tone39

Location:
Kent, England

Click Here to Email Tone39   Find more posts by Tone39

how do start ???

Hi folks
Just downloaded TNT but cant get it started,it just opens word,I know I am doing something wrong but what??,
HELP

05-12-2007 19:10

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

quote:
Hi folks
Just downloaded TNT but cant get it started,it just opens word,I know I am doing something wrong but what??,


It opens word... you mean Microsoft word?? you are on mac, right?

05-12-2007 19:10

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

what file are you openning... you should open the one called hieroglyph

05-12-2007 21:03

Posted by:
Tone39

Location:
Kent, England

Click Here to Email Tone39   Find more posts by Tone39

how do I start

Thanks Someone
I am on Mac running word, haven't got hieroglyph will get it thanks,

tone39

05-12-2007 21:57

Posted by:
Tone39

Location:
Kent, England

Click Here to Email Tone39   Find more posts by Tone39

how do start

Thanks Someone
For some reason stuffit didn't want to open the sit file got it to work now thanks,
New to Mac, Glad I made the change, big learning curve but worth the effort,
Tone39

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.