|
|
The following pages are my attempt to demystify Kiss code from my experience so far. I hope it helps. Once you have some cels then you need to put them in a 'cnf' file. For a tutorial about that go here. http://www.geocities.com/hallamshire/ with a 'cnf' file, you can begin to code the doll. If you've followed Zorro's tutorial above, you will have something like this: ; This .cnf file was written by PlayFKiSS. All I am going to deal with comes after ;@initialize(). In fact most of it will come after ;@begin() What does the code mean? Code diagram #1
In the diagram above: 1. Every line (after ; ** FKiSS stuff ** ) begins with ;@ 2. This is a command, in this case a left mouse click 3. The named cel is enclosed with (" ") 4. The cel name 5. This line is a sub-command and requires a space after the ;@ 6. The sub-command, in this case, makes the cel disappear The next bit of code deals with what is called 'snap-to', making one cel jump to a specific place in relation to another. Code diagram #2
7. In this command line, this is the cel that is movable, the one we've clicked on and moved with the mouse. 8. This is the cel that the first cel (7, 'any.cel') is coming into contact with (colliding) 5. See 5 above 9. Respectively these are saying, move a cel a certain amount on the x axis and on the y axis 10. This is the number in the ; ** Cel entries ** of the cel (any.cel) that we want to move in relation to... 11. ...this cel (body.cel)... 12. ...by this many pixels What is this x, y thing about? Code diagram #3
Regardless of the 'visible' shape of a cel in the doll viewer, all cels are drawn and exist in rectangular boxes. The top left most corner is the one we are interested in when we do a collide command. As you can see it is point 0 on the x and y axes. In 'Code diagram #2' the x and y co-ordinates were 23, 56, shown by the white dot in the diagram above. Code diagram #4
When 'any.cel' (#2) collides with 'body.cel' (#1) in Code diagram #2, the top left corner of 'any'cel, moves to the point x = 23, y = 56 in relation to 'body.cel' (#2). What you see in the Kiss doll viewer is Fig 4. This snap to code can also be written as follows, but this code works if any part of the invisible boxes touch whereas 'collide' works only when the visible parts of the cels touch (Thanks Tara for putting me right on this): ;@in(#1, #2) If you want to copy and paste the code I've used, here it is, just change the cel names, numbers and x, y co-ordinates to suit your needs: ;@press("any.cel") ;@collide("any.cel", "body.cel") If you want to make one cel disappear and make another cel appear in it's place, then use the following: ;@press("any.cel")
© 2000 Keith Lindsay-Cameron. All rights reserved. |