pablo
Menagerie
Posts: 10
|
Post by pablo on Aug 14, 2023 20:16:10 GMT
Hello again, I want to do a very simple inventory system, similar to the first Dizzy game: You can only take one object. If you press FIRE2 and you are above an object, you take it and drop whatever object you have. If you press FIRE2 and aren't above an object, you drop whatever you have. I am using variable O to keep the number of the object in the inventory. Why doesn't this code work?
IF KEY FIRE2 DETECTOBJ IF OBJ <> 255 ; did we detect an object? GET OBJ IF O <> 255 PUT O X Y ENDIF LET O = OBJ ELSE IF O <> 255 PUT O X Y LET O = 255 ENDIF ENDIF ENDIF
The effect of this code is: When I'm on top of an object and press FIRE2, I take the object. But when I press FIRE2 again, I don't drop it (PUT O X Y doesn't work)
Any help on this, please?
|
|
pablo
Menagerie
Posts: 10
|
Post by pablo on Aug 15, 2023 9:55:10 GMT
Ok, the reason why it doesn't work is because it's "PUT X Y O" and not "PUT O X Y" (even if the manual says otherwise!)
|
|
|
Post by xavisan on Aug 16, 2023 8:19:51 GMT
Ok, the reason why it doesn't work is because it's "PUT X Y O" and not "PUT O X Y" (even if the manual says otherwise!) When leaving objects, in my case I use the OBJ variable is used, not with the variable that has been set, with this you have it solved. Example: PUT 96 96 OBJ , PUT X Y OBJ_NUMBER The coordinates have to be free, and you have to take care not to have the player in the same position otherwise the object is never presented because it is always being picked up. Look at the examples that Ramon has posted in the forum and try before.
|
|
pablo
Menagerie
Posts: 10
|
Post by pablo on Aug 17, 2023 4:41:06 GMT
With "PUT X Y O", as mentioned, works well. Thanks in any case
|
|