rg80s
Central Cavern
Posts: 2
|
Post by rg80s on Jan 8, 2019 20:53:14 GMT
Hi all
Im working on a game similar to those of Manic Miner, Jet Set Willy etc and Im struggling to create a routine whereas an object falls downwards at random intervals and if the player is under it they will lose a life? The object basically goes down and then back up. Those that remember Monty Mole will remember the dreaded crushers - well thats the type of things im trying to create but struggling with a script? Can anyone help at all?
|
|
rg80s
Central Cavern
Posts: 2
|
Post by rg80s on Jan 8, 2019 21:14:55 GMT
I think I may be answering my own question but I guess the answer is by using enemy movement up/down type event ? But try to put in a script where the object moves up and down at random intervals?
|
|
|
Post by lukebord1 on Jan 21, 2019 19:02:08 GMT
Hi rg80s. Right, you have to write an up/down movement choosing a "type" (1 to 8) for the enemy sprite. There's a pre-defined template in AGD for a vertical patrolling enemy which will help. In order to perform a random interval, an idea could be to set a "start variable" using a RND condition in the main loop event, like this:
(main loop event) IF C = 0 GETRANDOM 30 (generates a random number from 0 to 29) IF RND > 20 (reducing the range of possibilites, in this case 21 to 29, the random interval will be less frequent) LET C = 1 (activates the movement) ENDIF ENDIF
(enemy type event) IF C = 1 ...vertical patrolling script...
IF X > ... (gameplay lower limit) LET C = 0 (reset the random switch variable) ENDIF
IF X <= ... (gameplay upper limit) LET C = 0 (reset the random switch variable) ENDIF
ENDIF
|
|