forums

TNT Basic Forums > Programming Q&A
Sprite Problems
< Last Thread     Next Thread >
Author
Thread        Post A Reply

03-13-2005 20:05

Posted by:
John Hughes

Location:
The Sceptered Isle

Click Here to Email John Hughes   Find more posts by John Hughes

:) First off, thanks incredibly for TNT Basic, I'm loving it. Until now I've been using SC, which is also very good in its own ways, as it is card based.

If anyone knows Monkey Island 1+2, Full Throttle, Simon the Sorceror 1+2, The Dig, Loom, Beneath A Steel Sky, Maniac Mansion, Sam & Max Hit the Road, and the Indiana Jones series, basically point and click adventure games, that's what I'm aiming for, and SC just won't do the job.

So far I have some very basic code to set a background image, and put a sprite on top. The image bank and spriteID are both correct for certain, yet this won't work:


' Let's get started shall we?
' Produces the menu screen

Fade down
Graphics mode 1440,900

Load images 2
Draw picture 138
Set image bank 139,2
Sprite 139,500,500,2
Fade up

While not Space
Draw frame
Wend
Fade Down


' Frame with main Menu has been drawn


It either uses a different sprite, or shows nothing... what am I missing? :)

Thanks in advance dudes!

03-13-2005 20:39

Posted by:
charlie

Location:
norfolk, england

Click Here to Email charlie   Find more posts by charlie

try this.

Fade down
Graphics mode 1440,900 'this must be a valid graphic mode for your 'monitor.

Draw picture 138
Load images 139 'this is the bank with your sprites in, by default it is 128

Set image bank 139,2

Fade up

While not Space
Sprite 139,500,500,2 here you are drawing the third sprite in the image bank.
'you have to draw the sprite every frame
Draw frame
Wend
Fade up




03-13-2005 20:57

Posted by:
John Hughes

Location:
The Sceptered Isle

Click Here to Email John Hughes   Find more posts by John Hughes

:) Thank you for the fast and helpful reply - my problem was I thought that the last value was the name of the image bank, like if I had one called 128-Sprites the last number would be 128. I also thought the first value should be image number, such as 139, rather than its little yellow number in the back, suchas 000,001,002 etc... it's working now. :D

03-13-2005 20:59

Posted by:
John Hughes

Location:
The Sceptered Isle

Click Here to Email John Hughes   Find more posts by John Hughes

I'm using this:

' Let's get started shall we?
' Produces the menu screen

Fade Down
Graphics Mode 1440,900

Load Images 5
Draw Picture 138

Fade Up

While Not Space
Sprite 5,700,700,9
Draw Frame
Wend
Fade Down


I'll now get it so that putting the mouse within a certain region makes this appear somewhere, it's a text image saying "Start a new adventure!" which appears when you roll-over "New Game".

03-13-2005 21:26

Posted by:
John Hughes

Location:
The Sceptered Isle

Click Here to Email John Hughes   Find more posts by John Hughes

' Let's get started shall we?
' Produces the menu screen

Fade Down
Graphics Mode 1440,900

Load Images 5
Draw Picture 138

Fade Up

While Not Space

if mouse x < 540
if mouse x > 440
if mouse y < 400
if mouse y > 350

Sprite 5,740,750,009

else

Sprite Off 5

end if
end if
end if
end if

Draw Frame

Wend
Fade Down


Should make it so that when the mouse enters a certain area (above the image for new game) the sprite with a text image pops up. It works to some extent, however it only goes on-off when you enter and leave the area from above. It will go on if you enter from the left, but only off again if you leave from the top.

:) It's confusing me a fair bit.

03-13-2005 21:38

Posted by:
John Hughes

Location:
The Sceptered Isle

Click Here to Email John Hughes   Find more posts by John Hughes

I should mention; if I add a "then" after each statement, it won't accept the "end if" or "else".

Thanks again :)

03-13-2005 21:48

Posted by:
charlie

Location:
norfolk, england

Click Here to Email charlie   Find more posts by charlie

if mouse x < 540 and mouse x > 440 and mouse y < 400 and mouse y >350

Sprite 5,740,750,009

else

Sprite Off 5

end if

this should probably do the trick,

the way you were douing this before like tends not to work properly. i find this easier to read and saves time scrolling up and down through source.

cheers
charlie

03-15-2005 19:09

Posted by:
John Hughes

Location:
The Sceptered Isle

Click Here to Email John Hughes   Find more posts by John Hughes

I'm sorry, I've been away from the computer for some time - thanks so very very much, I wasn't aware of the "and" syntax, it's so jolly logical and useful... thanks! :)

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.