forums

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

09-19-2004 14:33

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Hi,

I just can't find out how to get the Sprite Col to work in my game:(, this is my code:

if Sprite Col (9,10 to 29) <> -1
end
end if

Stephen,

09-19-2004 14:40

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Could anyone post that somewhere obvious????? I Can't remember how many times i answered that question!!!

if there is a collision, it will return the ID of the sprite to wich the specified sprite has collided!! so if it's 9,10 to 100, an number between 10 and 100 would mean there is a collision.

09-19-2004 15:26

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

So what whould I change my code to?

09-19-2004 15:30

Posted by:
charlie

Location:
norfolk, england

Click Here to Email charlie   Find more posts by charlie

i really cant see why people get this so wrong.

assuming your collision detection code is for player character hitting an enemy stored in an array, why not put the code inside your enemies loop, of in its own loop.

for example:

for o=0 to maxshots-1

if sprite col( 1 ,o+100)>=1

sprite off o+1000
enemyexists=false

end if

next o

or something like that, its pretty simple stuff really.

cheers
charlie

09-19-2004 17:00

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Well I have my code in a while wend,

09-20-2004 17:58

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Could some one please tell me what I should change my code to

09-20-2004 22:39

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

in fact i don't quite see, this code should work to some degree, maybe try

if Sprite Col (9,10 to 29) >=10 and Sprite Col (9,10 to 29)<=29
end
end if


if it still doesn't work then i'll need more of your code

09-21-2004 02:08

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Don't work

Well I changed my code to:

If Sprite Col (9,10 to 29)<=29
end
end if

and it quit my game,

Stephen,

09-21-2004 02:15

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

What is it you're trying to do? If you want the game to quit when sprite 9 collides with any sprite from 10 to 29, then your original code should be fine. Then it might be a problem in the rest of your code.

09-21-2004 14:31

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Ups,

I ment my code to be:

If Sprite Col (9,10 to 11)<=11
end
end if

Sorry will that make any difference?

Stephen,

09-21-2004 16:55

Posted by:
charlie

Location:
norfolk, england

Click Here to Email charlie   Find more posts by charlie

your really going to have to tell us more if you want help.

what is it you are trying to achieve exactly?

cheers
charlie

09-21-2004 17:07

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Well I have an animation of a bollet and I want to be if the last frame hits a ship the ship blows up and the number of the last sprite if 9 and the sprite number of the ships 10 an 11 and I want it to end when it hits the ship, Is that enough, or do you need my code(my code is RELLY BAD I not good at all at programming:()

it will be VERY hard for you to work with,

Thanks,
Stephen,

09-21-2004 22:27

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

>>>
Well I changed my code to:

If Sprite Col (9,10 to 29)<=29
end
end if

and it quit my game,

Stephen,
>>>>

of course! if there is no collision, i think it will return -1, so as -1 is < 29 the "end" statement will always be executed!!

please try the code i gave!

>
If Sprite Col (9,10 to 29)<=29 and Sprite Col (9,10 to 29)>=10
>

09-21-2004 23:08

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Yes, it would make a difference, Stephen.

Well after you try all of the other suggestions, try this one:
If Sprite Col (9,10 to 11)<>-1 then end

It's pretty much what you had before...and it should end if 9 collides with 10 or 9 collides with 11.

09-22-2004 01:42

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

I whould try your suggestions, But for some reason an error pops up when I try to start my game, it says:

*** Runtime exception caught ***
Line# : 149
Code : load images 128
Error : There was insufficient memory to complete the operation.

does anybody now why this is happening?

Stephen,

09-22-2004 04:28

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

When I get memory problems like that, it seems to help if I quit TNT and Heiroglyph and restart them.

09-22-2004 15:50

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

I did what you said, and the sam thing happens, I have an intro then when it is loding the error pops up,

any more suggestions?

Thanks,
Stephen,

09-22-2004 22:37

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

sounds like a stupid mistake or a bug?

could you submit the file somewhere for me to download?

09-22-2004 23:11

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

If you relly what it sure,

But I don't have a website,

Stephen

09-22-2004 23:19

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

You could email the file...or you could get some free webspace (ie at geocities you get 15MB). Webspace is always handy.

09-23-2004 01:59

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Do you want me to send it to you,

I don't now how to make a web page,

Stephen,

09-23-2004 02:55

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Uh...if you want me to look at it, you could send it to me. You don't need to know how to make a webpage, just how to use an FTP like Fetch.

09-24-2004 18:07

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

I'm working on puting my game online,

Stephen,

09-26-2004 22:02

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

ok,

I got the program online, thanks to Mark Snow for puting
it on his web site for a week or two,

Your a pilot of a F-18 hornet and your looking out of your
cockpit, you only can ply 3 missions and you can not complete any of them, because I can't find out how to make it so when you hit the enemy they blow up,

and when I was trying to find out how to do the colisions
I started geting the error after you choose a mission,

You can download it here:

http://uk.geocities.com/madmarkuk2003/Downloads/Blast_out____Bata.sit

Thanks,
Stephen

09-27-2004 18:08

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Error

Did anyone else have this error,

09-27-2004 22:28

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

looks like the website doesn't even exist anymore...

09-28-2004 01:08

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

What do you mean, when I click on the link it works, but if I cancel the download and start it again it says to try again later,

Stephen,

09-30-2004 01:42

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Well,

Well was anybody else abel to download it,

Stephen,

09-30-2004 06:19

Posted by:
Fischgurkensenf

Location:
Bern, Switzerland

Click Here to Email Fischgurkensenf   Find more posts by Fischgurkensenf

Yes,

I was able to download it.

I've looked at your example a bit. To your "sprite col" problem: You want to check for collisions between your shots and the enemy's ships, right? Which number have they?

sprite number,xpos,ypos,image

How do you check them?

sprite col (shotnumber,minEnemyshipNumber,maxEnemyshipNumber)

Is it possible that your problem is here?
I haven't read the code line for line, so your problem may be something different...

And for the ships I would arrays instead of variable1, variable2, variable3, and so on...

-IBD

09-30-2004 14:42

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

I tried it with out the sprite col thing out of my code and I still get the error, and what should I change my code to,

Stephen.

10-01-2004 07:05

Posted by:
Fischgurkensenf

Location:
Bern, Switzerland

Click Here to Email Fischgurkensenf   Find more posts by Fischgurkensenf

Perhaps it sounds hard, but if you can't find your error after hours: What about rewriting the whole code (or the code that handles sprites)?

Once I didn't found a stupid bug in my code unless I've completely re-readed my code.

10-01-2004 15:48

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Well i don't want to go back to the begining of my game:(, so I'm thinking of starting a diffrent game, or fixing my code up,

Stephen,

10-21-2004 19:55

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

I'm having a little trouble witht the "copy image" problem.
When I use this to put a sprite into the bank, I tell it to set the shink value to "true", but when I use the sprite in sprite collisions, it appears that the sprite col occurs far outside the normal bounds of the sprite - ie it has not been shrunk to bounds. I checked the sprite on a white canvas - the mask color is ok. I have also set collision tollerence to 255.

Has anyone else encountered this probem?

Thanks,
MapMaker

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.