How to get enemy alerts

ohtukrwohtukrw Sir dogeMember Posts: 106

How to set up alerts like watch out! in this game http://www.hungryherogame.com/

To help player increase awareness of the enemy.
Will show up 10 seconds into game. :blush:

Comments

  • IceboxIcebox Member Posts: 1,485
    edited July 2016

    You can do it this way i attached a demo hope it helps

    If your Hero actor wont move right and left, you can avoid constraining its position to a game attribute , you can do it this way

    if self.position x is < 900 and self.position.x is > 568
    display text

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @Icebox said:
    You can do it this way i attached a demo hope it helps

    If your Hero actor wont move right and left, you can avoid constraining its position to a game attribute , you can do it this way

    if self.position x is < 900 and self.position.x is > 568
    display text

    Another mystery solved :blush: Thank you

  • SocksSocks London, UK.Member Posts: 12,822

    @Icebox said:
    You can do it this way i attached a demo hope it helps

    A couple of quick notes, you don't need to constrain the hero's X position as there is nothing changing the hero's x position - also you cannot have a random value for an 'every' timer, 'every' means 'all' of something / 'all' of a set, so whereas every-2-seconds makes sense, every-differing-value doesn't make much sense !

    Or to put it another way, saying a shop opens every Saturday makes sense, saying a shop opens every random day doesn't make much sense, there would be no use for the word 'every' here.

    Anyhow, basically an every-random timer doesn't work, the timer will simply generate a random value and use that single random value for every iteration.

    Hope that makes sense !

  • IceboxIcebox Member Posts: 1,485

    @Socks Yes I already mentioned no need to constrain if the hero wont move , but the random every timer , i didnt think of it this way before , your right it makes sense now

  • IceboxIcebox Member Posts: 1,485
    edited July 2016

    @Socks how would i make this ? i just noticed now it really doesnt work :) I did it alot before and never noticed , so

    if i wanted to spawn after random number of seconds , and repeat the same timer over and over, I will have to put it in a condition with a game attribute ? Is this the way to approach it ?

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    @Icebox said:
    if i wanted to spawn after random number of seconds , and repeat the same timer over and over . . .

    I do it like this . . .

    After random(x,y)
    --Spawn something
    --Destroy
    --Spawn this actor

  • IceboxIcebox Member Posts: 1,485

    @Socks nice ! thanks alot

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    @Icebox said:
    @Socks nice ! thanks alot

    If you want to limit the amount of spawns (let's say to 200) . . . make a game.attribute, let's call it 'S'.

    When S is < 200
    --Change S to S+1
    --After random(x,y)
    ----Spawn something
    ----Destroy
    ----Spawn this actor

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    @Socks said:

    @Icebox said:
    @Socks nice ! thanks alot

    If you want to limit the amount of spawns (let's say to 200) . . . make a game.attribute, let's call it 'S'.

    When S is < 200
    --Change S to S+1
    --After random(x,y)
    ----Spawn something
    ----Destroy
    ----Spawn this actor

    Hi I have a little problem. I managed to set up the alerts on the left and right side, following @Icebox method. But I failed to do it on up side.
    Can you advise me on these?

    http://tinypic.com/r/2crskea/9

    http://tinypic.com/r/1112sdj/9

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @Icebox said:
    @Socks nice ! thanks alot

    Hi I have a little problem. I managed to set up the alerts on the left and right side. But I failed to do it on up side.
    Can you advise me on these?

    http://tinypic.com/r/2crskea/9

    http://tinypic.com/r/1112sdj/9

  • IceboxIcebox Member Posts: 1,485
    edited July 2016

    @ohtukrw said:

    @Icebox said:
    @Socks nice ! thanks alot

    Hi I have a little problem. I managed to set up the alerts on the left and right side. But I failed to do it on up side.
    Can you advise me on these?

    http://tinypic.com/r/2crskea/9

    http://tinypic.com/r/1112sdj/9

    The links dont open for some reason, sorry ! But its easy to do just wrap a condition to keep track of how close it is to the hero's y position.
    In the enemy actor
    if self.position y is < maximum y position and
    self.position y is > minimum y position (so its between these 2 values)
    display text, relative to the scene at the positions you want :)

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @Icebox said:

    @ohtukrw said:

    @Icebox said:
    @Socks nice ! thanks alot

    Hi I have a little problem. I managed to set up the alerts on the left and right side. But I failed to do it on up side.
    Can you advise me on these?

    http://tinypic.com/r/2crskea/9

    http://tinypic.com/r/1112sdj/9

    The links dont open for some reason, sorry ! But its easy to do just wrap a condition to keep track of how close it is to the hero's y position.
    In the enemy actor
    if self.position y is < maximum y position and
    self.position y is > minimum y position (so its between these 2 values)
    display text, relative to the scene at the positions you want :)

    They open fine. Try a different browser. Or a zoom button on the left side please. :/

  • IceboxIcebox Member Posts: 1,485

    @ohtukrw said:
    They open fine. Try a different browser. Or a zoom button on the left side please. :/

    I tried it doesnt display anything just a blank page , maybe its a regional thing ,anyway here is an explanation i think you will get it by your own. Good luck !

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @Icebox said:

    @ohtukrw said:
    They open fine. Try a different browser. Or a zoom button on the left side please. :/

    I tried it doesnt display anything just a blank page , maybe its a regional thing ,anyway here is an explanation i think you will get it by your own. Good luck !

    Try this one
    http://www19.zippyshare.com/v/GYkJ3HL4/file.html
    I have provided the rules but i don't know what is wrong with them :/

  • IceboxIcebox Member Posts: 1,485

    Yes get rid of the constrain and make it the way i mentioned above :) it will work

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    @Icebox said:
    Yes get rid of the constrain and make it the way i mentioned above :) it will work

    My way it does work but, the ''!'' is flying around like crazy, i just want it to be next to the screen edge and follow bird's position.

    Also my scene height is bigger than showed and I understand the concept, but having trouble maintaining alert's position.

  • IceboxIcebox Member Posts: 1,485
    edited July 2016

    @ohtukrw said:
    My way it does work but, the ''!'' is flying around like crazy, i just want it to be next to the screen edge and follow bird's position.

    Your problem is here , adjust its position the way you want , x is horizontal and y is vertical. Horizontal should be self.position.x and vertical is a fixed number for the top edge.

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @Icebox said:

    @ohtukrw said:
    My way it does work but, the ''!'' is flying around like crazy, i just want it to be next to the screen edge and follow bird's position.

    Your problem is here , adjust its position the way you want , x is horizontal and y is vertical. Horizontal should be self.position.x and vertical is a fixed number for the top edge.

    I just had them mixed up. I see, I see :smiley:

Sign In or Register to comment.