Jump to content
IGNORED

Sprites and Chars


Retrospect

Recommended Posts

CALL COINC assigns a value to tell if sprites or a sprite and a point on the screen are at or near the same location on the screen. CALL DISTANCE indicates the distance between two sprites or a sprite and a point on the screen.

 

CALL COINC( #sprite-number, dot-row, dot-column, tolerance, numeric-­variable )

 

A sprite and a location are coincident if the upper left hand corner of the sprite and the position specified by dot-row and dot-column are within the value specified by tolerance. These coincidents are reported even if there is no apparent overlap of the sprites or the sprite and the position.

 

CALL DISTANCE( #sprite-number, dot-row, dot-column, numeric-variable )

 

The position of each sprite is considered to be its upper left hand corner. The squared distance is returned in numeric-variable.

Link to comment
Share on other sites

Using CALL POSITION and then converting the dot information to row and column, and then using CALL GCHAR might be better. Only thing is, CALL GCHAR, IIRC, is rather slow, but if you're compiling then that should not be a problem.

 

Thanks .... yeah, I'll give that a try. Yes I will be compiling my code, I do with almost all my stuff nowadays. It makes everything so much tighter and the sprites actually behave themselves. You should have seen the state of "Freeway" before it was compiled. The chickens were practically invulnerable and the only point of recognition was when they hit the top of the screen! :)

Link to comment
Share on other sites

I just read somewhere that Commodore got the idea from TI for the concept of Sprites.

 

From Wikipedia;

 

The VIC-II chip was designed primarily by Al Charpentier and Charles Winterble at MOS Technology, Inc. as a successor to the MOS Technology 6560 "VIC". The team at MOS Technology had previously failed to produce two graphics chips named MOS Technology 6562 for the Commodore TOI computer, and MOS Technology 6564 for the Color PET, due to memory speed constraints.[1]

In order to construct the VIC-II, Charpentier and Winterble made a market survey of current home computersand video games, listing up the current features, and what features they wanted to have in the VIC-II. The idea of adding sprites came from the Texas Instruments TI-99/4A computer and its TMS9918 graphics coprocessor.[2] About 3/4 of the chip surface is used for the sprite functionality.

Link to comment
Share on other sites

One thing you should know about when using CALL COINC is that the manual does not describe it quite accurately. According to the manual if the distance is greater than the tolerance then there is no coinc. Actually, if either the x distance or the y distance is <= the tolerance then coinc is reported. So if the tolerance is 10, the X distance is 10 and the Y distance is 10 then coinc is detected even though the distance is actually 14.14 pixels.

  • Like 1
Link to comment
Share on other sites

Look in the GPL manual it explains the Sprites very well and the later Editor Assembler book copied most of this info.

 

http://www.retroclou...mmers_guide.pdf

 

Ahhh Rich ,,. there you are. You just reminded me, I am intending to make a text adventure for use with RXB2012. (possibly early 2013)

I like the CALL HPUT command because it allows 32 characters across, and without looking back again at the manual I'm thinking there was 40-character mode too?

 

post-34058-0-75085400-1351898293_thumb.png

Edited by Retrospect
Link to comment
Share on other sites

Well if you put the video mode into 40 column mode it will do the HPUT but you will get some odd behaviors.

As the video mode changes the X and Y values of the DCHAR buffer Row and Col buffers.

So I would use the MOVES command instead as it does not care what Video mode you are in and would even work for Multi or Bit Map.

Of course then you have to re-arrange Video memory before you screw up something in string space.

Now HPUT in 40 col mode will put stuff where you want but sees only 768 characters on the screen so will not go beyond that limit.

HGET would work the same way.

 

100 WD$="This is a test screen of 40 column mode and we can see that unless we redefine the characters and length we get problems."

110 CALL MOVES("$V",76,WD$,47)

 

This would work better, but then at end you screen you have to keep track to not put stuff over the screen size limit.

Link to comment
Share on other sites

  • 1 month later...

! Color the sky
100 CALL CLEAR::CALL CHAR(33,"8")::CALL COLOR(2,3,3)::CALL SPRITE(#1,33,2,96,128,6,3)
110 CALL POSITION(#1,Y,X)::IF Y<193 THEN CALL HCHAR(INT((Y-1)/8)+1,INT((X-1)/8)+1,40)::GOTO 110
120 CALL LOCATE(#1,192/2,256/2)::CALL MOTION(#1,RND*12-6,RND*12-6)::GOTO 110

 

! Walk on by
100 CALL CLEAR::CALL CHAR(33,"8")::CALL COLOR(2,3,3)::for x=1 to 8::call hchar(rnd*23+1,rnd*31+1,40,rnd*31+1)
110 call vchar(rnd*23+1,rnd*31+1,40,rnd*23+1)::next x::CALL SPRITE(#1,33,2,96,128,6,3)
120 CALL POSITION(#1,Y,X)::IF Y>192 THEN CALL LOCATE(#1,192/2,256/2)::CALL MOTION(#1,RND*12-6,RND*12-6)::GOTO 120
130 CALL GCHAR(INT((Y-1)/8)+1,INT((X-1)/8)+1,G)::IF G=32 THEN 120 ELSE CALL SOUND(-150,110,0)::GOTO 120

 

:party:

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...