Is it possible to do this with Gamesalad...?

allc1865allc1865 Member, PRO Posts: 777
Is it possible to have multiple enemies that have been spawned shoot at you at the same time in your game?

Thanks.

Best Answers

  • -Timo--Timo- Posts: 2,313
    edited October 2013 Accepted Answer
    yes :)
    first make 2 game integer attributes. playerY and playerX
    constrain game.playerY to self.position.Y
    constrain game.playerX to self.position.X

    in bullet you have rotate to position
    game.playerX game.playerY
    speed 1000

    and let it move to self.rotation.

    not sure if this is the best way but it should work ;)
    hope this helped :)
  • BellowBellow Bartender Posts: 227
    edited October 2013 Accepted Answer
    Yes make game attribute fire

    for you shoot make a rule

    when attribute fire 0

    spawn actor fire
    change attribute fire 1


    at the fire attribute

    put timer after 3 sec (or whatever)

    destroy this actor
    change attribute fire 0

    maybe this will help you. Put this rule for your enemies


    Lol i think i understand question wrong way and you were faster than me :'(
  • -Timo--Timo- Posts: 2,313
    Accepted Answer
    @timolapre1998, first make 2 game integer attributes. playerY and playerX
    constrain game.playerY to self.position.Y
    constrain game.playerX to self.position.X
    These behaviors go into the enemy actor, I'm assuming, correct? :)
    nope, inside the player ;)
  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer
    Here you go, use left and right arrows to avoid the bullets . . .


Answers

  • SocksSocks London, UK.Member Posts: 12,822
    Sure, just design the enemies so they target you . . . . and spawn a bunch of them !

    It really is that straightforward . . . hold on let me make you a quick demo . . .
  • allc1865allc1865 Member, PRO Posts: 777
    @Socks, thanks so much! It will help out a lot ;)
  • allc1865allc1865 Member, PRO Posts: 777
    @timolapre1998, first make 2 game integer attributes. playerY and playerX
    constrain game.playerY to self.position.Y
    constrain game.playerX to self.position.X
    These behaviors go into the enemy actor, I'm assuming, correct? :)
  • allc1865allc1865 Member, PRO Posts: 777
    I already have an integer attribute for playerX and playerY for a mini map I'm building. Can I use those attributes to make this?
  • allc1865allc1865 Member, PRO Posts: 777
    @Socks, thank you so much. This helps me out a lot.
  • -Timo--Timo- Member Posts: 2,313
    I already have an integer attribute for playerX and playerY for a mini map I'm building. Can I use those attributes to make this?
    if you constrained to positions from the player to the attributes then yes :)
  • SocksSocks London, UK.Member Posts: 12,822
    Here's the same thing, but enemies shooting at you at the same time, it's a bit messy but you should get the idea.
  • allc1865allc1865 Member, PRO Posts: 777
    @Socks, that's great. That will help me out a lot. One more question here. How can I make enemies spawn when the player gets to a certain point? I thought about having an invisible actor in the scene that said, when it collides with actor, spawn enemies...But I wasn't too sure about that. Thanks for all your help.
  • allc1865allc1865 Member, PRO Posts: 777
    Thanks for all your help, guys :)
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    Lol, ridiculous forum software sucks !

    When you select a post as the answer the forum deletes the attachment, rendering a lot of answered questions supplied as an example GameSalad project completely useless.

    Future GameSalad users can browse the forums looking for solutions to issues to be met with dozens of empty posts.

    Absolutely useless, this has been happening for months now, there are so many issues with Vanilla, why can't GameSalad just use off the shelf BB software ? Pretty much every forum I look through has things like buttons to embolden type, to create links, to embed pictures, but here it's up to users to code everything, even italicising type, sure it's not too difficult, but it's totally unnecessary given there are so many much better options out there. God I hate this forum software, lol !! :(( And that's without mentioning that fact that I can't stay logged in for more than 2 or 3 posts, constantly having to retype my email address and password, constantly losing posts I've typed out because half way through Vanilla decides to log me out and tell me 'you don't have permission to do that', 'you don't have permission to do that', 'you don't have permission to do that', 'you don't have permission to do that', 'you don't have permission to do that' all freaking day, for years (literally years) . . . . . aghhhhhhhhhhh I hate this forum platform so freaking useless, so time wasting, such a pain to use !


    [rant over, need a coffee and some crack to calm down]
  • BellowBellow Bartender Member, PRO Posts: 227
    @socks i agree with you for coffee time lol
  • SocksSocks London, UK.Member Posts: 12,822
    @socks i agree with you for coffee time lol
    But not the crack ? :))
  • -Timo--Timo- Member Posts: 2,313
    edited October 2013
    @socks do you really have to login again every 2 posts you place? I dont have that problem. I logout auto every week or so.
    I dont agree with "I hate this forum platform so freaking useless" :P
    I am glad you calmed down ;)
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    @Socks, that's great. That will help me out a lot. One more question here. How can I make enemies spawn when the player gets to a certain point? I thought about having an invisible actor in the scene that said, when it collides with actor, spawn enemies...But I wasn't too sure about that. Thanks for all your help.
    Your invisible actor + collide rule would work fine, you can also just stick some rules in the player actor that say (assuming a 2D location):

    When:
    player's X position is larger than (>) 100 and smaller than (<) 200 . . . . and
    player's Y position is larger than (>) 600 and smaller than (<) 700 . . .
    . . . then spawn whatever you want to spawn.

    This will give you a 100 x 100 area in the upper-lefthand side of the screen that will spawn whatever you want spawning when the player goes into that area.

    But your invisible actor method is just as good, and probably easier to modify, move around and so on.
  • allc1865allc1865 Member, PRO Posts: 777
    Okay, thank you for your reply. I will try that...
    Thanks everyone for your help!! :)
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    @socks do you really have to login again every 2 posts you place?
    Yeah, sometimes I can stay logged in for 10 minutes or so, sometimes I get logged out a few times during a single post - e.g. I'm logged in, I type out half a dozen words, I then go to attach a file . . . 'you don't have permission to do that' . . I'm then logged out, log back in, retype the post, then I'm logged back out . . . etc etc ad nauseum . . . sometimes I'm just logged out in the middle of typing out a short post, there's no consistency, it's a real pain in the ass.

    This has been going on for years, I know others are effected by it too, it's not my system as during the time it's been happening I've changed computer three times (G5 > iMac > newer iMac), changed internet service provider at least twice, changed operating system (snow leopard, lion, mountain lion) and even moved house, it happens in all the browsers I've tried, so I think it's reasonable to conclude it's at the server end . . . and additionally every other single forum I look through and post in is absolutely trouble free, never logged out (unless I want), no lost posts, or deleted attachments etc, but then again they aren't using Vanilla.
    I am glad you calmed down ;)
    The crack hasn't kicked in yet, give it a few more minutes, I find with vanilla forum software my tolerances have risen, I need a couple of dozen 'rocks' washed down with a 50/50 coffee/floor polish mix just to stay calm.
  • allc1865allc1865 Member, PRO Posts: 777
    @Socks, that's great. That will help me out a lot. One more question here. How can I make enemies spawn when the player gets to a certain point? I thought about having an invisible actor in the scene that said, when it collides with actor, spawn enemies...But I wasn't too sure about that. Thanks for all your help.
    Your invisible actor + collide rule would work fine, you can also just stick some rules in the player actor that say (assuming a 2D location):

    When:
    player's X position is larger than (>) 100 and smaller than (<) 200 . . . . and
    player's Y position is larger than (>) 600 and smaller than (
    Is there a way to spawn just simply 10 enemies or 15? Not really a random number.
    I thought of having a timer, after 5 seconds, stop spawning, but there is no 'stop spawn' behavior.
    Thanks.

  • BellowBellow Bartender Member, PRO Posts: 227
    @Socks, that's great. That will help me out a lot. One more question here. How can I make enemies spawn when the player gets to a certain point? I thought about having an invisible actor in the scene that said, when it collides with actor, spawn enemies...But I wasn't too sure about that. Thanks for all your help.
    Your invisible actor + collide rule would work fine, you can also just stick some rules in the player actor that say (assuming a 2D location):

    When:
    player's X position is larger than (>) 100 and smaller than (<) 200 . . . . and
    player's Y position is larger than (>) 600 and smaller than (
    Is there a way to spawn just simply 10 enemies or 15? Not really a random number.
    I thought of having a timer, after 5 seconds, stop spawning, but there is no 'stop spawn' behavior.
    Thanks.

    put game integer said spawncount and for your spawning enemies make a rule at the spawn for everytime one spawn

    change attribute spawncount+1

    and put a new attribute rule under your spawning

    spawn actor if attribute<15 or 10 how many spawn you want
  • allc1865allc1865 Member, PRO Posts: 777
    @Bellow, thanks for your reply. Just so I understand what you're saying, I would create an integer attribute called 'spawncount'. Then in my enemies actor, create a rule that says change attribute > spawncount > 1... Sorry, I'm trying to understand what to do :)
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    Is there a way to spawn just simply 10 enemies or 15? Not really a random number.
    I've alway thought that was a glaring omission from the Spawn Behaviour, it really should have a count in it, you tell it what you which actor you want spawning, where they should go and - crucially - how many actors you want it to spawn.
    I thought of having a timer, after 5 seconds, stop spawning, but there is no 'stop spawn' behavior.
    There's not need to stop spawning, it stops by itself as it only spawns one actor.

    If you want a specific amount of actors spawned, just make an attribute (let's call it "count") then have a rule that spawns an actor, adds one to the count, checks the count is still under 15 (or whatever) before spawning another.


    EDIT: what @Bellow said :)>-
  • BellowBellow Bartender Member, PRO Posts: 227
    @allc1865

    sorry i am not good teacher :D

    like you said create attribute spawncount. In your enemies actor you already make a spawn actor rule right ? put it this rule here if attribute spawncount<15 this will make it if you spawn 15 enemies it doesnt spawn anymore

    and again in that rule at the do section put change attribute spawncount +1 so this time whenever you spawn you spawncount going to up 1 when it hit 15 it wont be spawn enemies anymore.
  • SocksSocks London, UK.Member Posts: 12,822
    @Bellow, thanks for your reply. Just so I understand what you're saying, I would create an integer attribute called 'spawncount'. Then in my enemies actor, create a rule that says change attribute > spawncount > 1... Sorry, I'm trying to understand what to do :)
    Here's a quick example:

  • allc1865allc1865 Member, PRO Posts: 777
    Thanks, guys for your help. @Bellow & @Socks.
    I tried to get the enemy spawners to stop at a certain point and shoot at the player...so I placed a wall collider in my scene, and it stopped them, but they also stopped shooting...
    Any ideas on how to solve this?
    Thanks for your help anyway everyone. I will definitely use these templates.
  • BellowBellow Bartender Member, PRO Posts: 227
    edited October 2013
    look for magnitude function it will be help you


    here check this one

  • allc1865allc1865 Member, PRO Posts: 777
    Yes, that helped. Thanks a lot, but he didn't show you how to stop your player when he comes towards you.
Sign In or Register to comment.