EdD
Wacky Amoebatron
Posts: 35
|
Post by EdD on Apr 22, 2024 15:30:50 GMT
Buenas....
¿Se podría hacer que los objetos actuaran como los sprites con el comando FALL? Necesito que caigan y paren en el suelo.
Could you make objects behave like sprites with the FALL command? I need them to fall and stop on the ground.
|
|
mas
Processing Plant
Posts: 28
|
Post by mas on Apr 22, 2024 20:42:34 GMT
I think you have a few options here.
1/ Use a sprite to represent the object (so you get the "fall") and when it hits a solid (wall block/ platform block) replace the object with an object at the location. (This could work for "dropped loot crates" that contain something. You could even have it animate on landing and then replace itself with the object)
IF AIRBORNE ELSE ;; we are on the ground PUT X Y object ; where object is the object you've dropped REMOVE ; get rid of this sprite EXIT ENDIF
FALL
2/ You would need a control routine for this. You would have two variables for the object X and Y. You would then getblock the block below the object. If it's an empty block, then increment the Y attribute.
;; using A and B for object X and Y. Assuming a timing loop where F = 0-25 frames per second. Will update on frame 2
IF F = 2 LET RND = A ; using RND and OPT and OBJ as TEMPORARY VARIABLES LET OPT = B LET OBJ = 0 ; will use OBJ = 0 for checking for non empty blocks ADD 16 TO OPT ; next block below the object REPEAT 2 GETBLOCK RND OPT IF BLOCK <> EMPTYBLOCK ADD 1 TO OBJ ENDIF ADD 8 TO RND ENDREPEAT IF OBJ = 0 ADD 4 TO B ;; add 4 to the object's Y ENDIF GET object ; edited to add this in - testing - the object needs to be removed before it respects the new co-ords PUT A B object ENDIF
;; you will probably want to spawn an object for the loop, and then have the sprite remove itself when the object lands.
Those are the two options I can think of off the top of my head. All code untested and straight from my brain so might need some tweaking, but hopefully it'll give you some ideas depending on how you want this to appear.
|
|
EdD
Wacky Amoebatron
Posts: 35
|
Post by EdD on Apr 22, 2024 21:08:45 GMT
Muchas gracias, la primera opción me sirve para otras ideas que tengo, pero quizás no para estas, ya que son 20 objetos distintos que tendría que representar con otros 20 sprites, y eso seria imposible. Pero me gusta mucho la idea para futuros proyectos. Pensé que seria algo más fácil, como un simple FALL. La segunda me parece interesante. Muchas gracias.
Thank you very much. The first option it's useful for other ideas I have, but maybe not for these, as there are 20 different objects that I would have to represent with another 20 sprites, and that would be impossible. But I really like the idea for future projects. I thought it would be something easier, like a simple FALL. The second one sounds interesting to me. Thank you very much.
|
|
|
Post by ramon on Apr 23, 2024 4:25:27 GMT
|
|
mas
Processing Plant
Posts: 28
|
Post by mas on Apr 23, 2024 11:02:06 GMT
This morning I woke up and on the way to the office had a thought that you probably could just do a mashup of my previous options and have a falling sprite getting and putting the object as it falls - and when I get to the board I can see Ramon has had a similar idea.
Good luck! I'm looking forward to seeing this in action in the final game.
|
|