|
Post by lukebord1 on Dec 16, 2013 1:31:54 GMT
When i GET an object, i tried the PUT command in order to remove it from the inventory.
As said in the manual, PUT drops the object "onto the screen, at the current sprite's position"...
But how is it possibile to definitively remove it without releasing on the screen ? Is there a kind of REMOVE command for objects ?
|
|
|
Post by BiNMaN on Dec 16, 2013 22:52:54 GMT
I don't think I've ever got an object to drop at a sprite position, I've only ever managed to drop it on a screen where the position was determined when you are editing and pressed p for position in OBJECTS
|
|
|
Post by BiNMaN on Dec 16, 2013 23:02:15 GMT
just tried to PUT the object in the pumpkins demo, you drop the gun but immediately pick it up again
don't think I've ever sussed out how this works
|
|
|
Post by lukebord1 on Dec 17, 2013 16:44:21 GMT
If we use PUT outside the Sprite #0 routine, AGD crashes (tested), because it needs player's X Y coordinates. So PUT command drops collected objects in player's position (like in Atic Atac, sometimes it could be useful to bring objects and drop them elsewhere)...
In order to avoid objects to reappear onto our rooms, maybe manually we have to do something like this :
IF KEY 4 IF GOT 2 (assuming 2 is the object) LET OBJ = 254
That won't work, because OBJ is only the result of DETECTOBJ, i'm not sure if we can assign other values to it...
Jonathan, what do you say !?
|
|
|
Post by Jonathan Cauldwell on Dec 21, 2013 13:54:30 GMT
The object handling isn't designed that way. Objects can only be picked up and dropped by sprites. If no sprite is defined (eg you're dropping an object from somewhere other than in a sprite event) AGD will attempt to place the object at whatever sprite coordinates it finds, which will be complete nonsense. When it attempts to draw that object it could be off-screen, which means system variables, BASIC, streams etc could be overwritten... hence the crashes. It doesn't have to be the player sprite though. Any sprite should be able to pick up and drop an object.
I'll include some protection off-screen coordinate when I next make changes to the engine and consider expanding the object handling functionality.
Binman - if memory serves, the Pumpkins demo automatically picks up any object with which the player comes into contact. You'll have to put the pick up code after an IF KEY. If you detect the gun, great, pick it up. If not, and you're carrying it, drop it.
|
|
|
Post by lukebord1 on Jan 7, 2014 17:05:01 GMT
Maybe it could be useful a hybrid add-on inbetween objects and sprites: DOORS. I mean doors which open once, if for example i have a key, but remain open when i return in the same room. Sprites removed reappear, and objects are put in the inventory! Doors simply could objects put on the screen following a dynamic permanence.
For the instance, i use variables which store 0/1 switches in order to decide if a door- sprite has to appear or not.
Maybe i can try "removeblock" instead, and build doors with blocks?
|
|
|
Post by alessandro on Jan 16, 2014 21:52:44 GMT
In Cronopios y Famas, in order to make certain objects disappear from the inventory when used, I employed this trick. The character sprite is briefly "sent" to a location of the screen, a 16x16 black ink/paper space inaccessible to the player. This is usually done by adding and/or subtracting a certain number to the current location of the character when it comes in contact with an invisible (empty) sprite.
The object is dropped with a PUT command, then the character sprite goes back to the same location as before, by returning to the previous coordinates.
In order to be effective, this technique requires that a separate key must be used to pick up/drop objects. It won't work when objects are made to be picked up instantly as soon as the character touches them.
Example:
an object must be given to another (non-player) character in the game. The player sprite faces the other character. If a series of conditions is met (screen number, object held, contact with the invisible sprite) the character coordinates are changed by subtracting 60 to the x co-ordinate. The sprite is then briefly brought to an empty (black ink and paper) inaccessible location in the screen and the object is dropped, then 60 is added to the x co-ordinate in order to bring the character back to its previous location. The object is still on the screen, but it can't be neither seen nor picked up again.
The process is so fast that the player won't ever notice it!
|
|
|
Post by lukebord1 on Jan 19, 2014 20:46:35 GMT
Very interesting trick, it worth a try!
|
|