|
Post by BiNMaN on May 10, 2013 16:11:04 GMT
I haven't managed it so far but is it possible to spawn a sprite using a variable?
The standard argument is SPAWN 1 2 (for example), but I'm doing a game which has 8 way directional control and due to how the player is drawn I need 8 different bullet sprites due the offset of the players gun. I'm using DIRECTION to guage which DIRECTION the player is facing so I know which bullet IMAGE I need depending on which way the bullet needs to go.
At the moment I'm using a lengthy
IF KEY 4 IF DIRECTION 0 SPAWN 1 0 ENDIF IF DIRECTION 1 SPAWN 1 1 ENDIF ...ETC... ENDIF
I was kind of hoping all I would need to do is
IF KEY 4 SPAWN 1 DIRECTION ENDIF
Thus negating the need for a lengthy bit of script. I don't think it's possible but it would be handy if it is.
|
|
|
Post by Jonathan Cauldwell on May 13, 2013 20:29:43 GMT
SPAWN is one of a few instances where the parameters cannot be a sprite parameter or variable.
Put your direction in a variable, then once you've spawned the sprite you should be able to use SPAWNED to select the new sprite, set the direction manually from the variable then use ORIGINAL to return to the original sprite.
|
|
|
Post by BiNMaN on May 14, 2013 21:21:10 GMT
yeh that was my next thing to do, cheers mister
I may go down the ... LET A DIRECTION ... SPAWN 1 2 SPAWNED LET FRAME A ORIGINAL ...
route
that way I can use the bulk of the bullet script for the player and the enemy bullets, I can use the FRAME to dictate the direction of the bullet then use the IMAGE when it comes to collision
|
|