Some How to's for my game.

0 favourites
  • 13 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello everyone.

    I'm new around here, although I've been reading some tutorials and trying some stuff out.

    I'm actually working on a game. It's an arcade game, in perspective.

    Some friends are working on the artistic part of it, so I am currently working with own-made boxes.

    Basically, I have an area, surrounding my player character (pinned to it), and if an enemy gets into the area, it should react by shooting at me, and moving towards me.

    The problem I'm having is the following one:

    When an enemy enters into my "area", ALL the enemies start to shoot me, while I only want to shoot me the one inside my "area".

    How can this possibly be done?

    I've settled a health counter for the enemies, which work great, and it's independant for each enemy, but I've tried adding a boolean, which settles if it's inside the area, or not, but still, while doing so, all the enemies attack me.

    It's like that boolean would be linked to them all, and would switch for them all at the same time.

    Also...and I'm currently working on this, how can I make the enemies to shoot at my position, instead of "straight".

    Thanks a lot for the help provided,

    Miyavi

    Get the capx

    Edit:

    Already managed to shoot at my position.

    Also added a decreasing life bar, but it's anchored to the screen, and if you realise, whenever you move, it vibrates horizontally.

    How could I solve this?

    Also, link to playable content

    Edit2:

    I already solved enemies chasing me.

    Yet, I have no clue on how to make the enemy that enters my active zone (and not them all at once) to chase and shoot me.

    Any helping hand out there? :)

    I guess it has to be done with UIDs, right?

  • No one could help me out?

  • the .capx doesn't work can you re-upload , also i would say try to put enemy veriable for example put (enemyattack-false)

    so when the enemy collision with player-area attack put the enemyattack-true.

    and put event if enemyattack true = enemy will attack,change direction...

    try it maybe it will fix ^^ if not try to use array (array 100% can fix this but im not good in it)!

  • Sorry, I re-structured my dropbox yesterday, and forgot to upload the new .capx

    Here's the new one

    Also, I've tried doing what you say.

    I declared an instance variable for enemy1, which is a boolean, and I switched it on when they collided with my active zone, but it was just the same, every enemy would attack me, although they weren't in my active zone, so it's like all their boolean var would switch at the same time.

    I haven't looked into arrays nor UIDs yet, but AFAIK, every created object has a UID, so I could store the one colliding to my player's zone in an array.

    I'll have to look it up.

    Here's the new playable content, too.

    Greetings,

    Miyavi.

  • Event 13, replace "System every tick" by "Enemy1 is zoned" (is boolean set) helps with picking only the zoned enemy and so you're only followed by enemies at range.

    As soon as the enemy is not in your range anymore, it stops.

    Event 18 add also a "Enemy1 is zoned".

    <img src="http://dl.dropbox.com/u/36472942/construct/forumhelp/EnemiesRange.JPG" border="0">

    The problem here was about picking, picking only the correct instances and that's the backbone of C2.

    Check the How do I FAQ and check the section "Picking/Selecting instances" and review the items listed there.

    The threads contains all the explanations one might require about picking.

  • Wow, thanks, Kyatric... so it was me, not doing it correctly.

    I'll check those threads right now.

    By the way, is there a way to change an object name, so it updates the actual "code".

    I mean, if, for example, I decide to change my "enemy1" name to archer, could I do it so I don't have to manually change everything on the actions/events? (As done with search and replace, in usual programming)

  • Miyavi, I'm not sure if it's exactly what you're referring to, but C2 automatically renames all occurrences of an object in the event sheet(s) when you change the name of the object. It's one of the things you really have to love about C2!

  • Yeah, I meant that.

    I didn't try that out, since I wasn't in the need to do so, but it's nice to know, if I ever need to do it (which I will :P)

    By the way, what about making a class which entends from another one?

    For example, I have enemy1, which is an archer, indeed.

    I want to have a class "Enemy", and some types of enemies, who will extend from Enemy.

  • There's a way to do so with the families feature (licensed version).

    I haven't yet tested how to, and I don't recall having seen documentation about this yet, but it should be easy enough.

    That's what Ashley has implemented, as closer to the class system of coding language, in C2 I think.

    There are other possibilities to do so anyway, they require more events/setup though.

    Generaly I'd advise to use an array, store the values/characteristics of your "class" there and apply those values to newly created instance "Enemy" making it of said class on creation.

    I made this commented capx some time ago to answer a similar question.

    It's not the exact principle of class as in coding language, but it does the trick "C2's way" I think.

    Hope it can be useful to you.

  • Thanks Kyatric, I'll check it up.

    I'm actually implementing a timer and score based on the level left time, nothing too fancy :P

    Is there any way to freeze the game until, let's say, I press a button?

    In my game, if I die, the enemies keep shooting at something, so I want to freeze the game.

  • So.. I just set the timer, but a funny thing happens.

    If I'm moving, or attacking or whatever, it goes correctly, but if I just idle, my time runs out way faster.

    How I implemented the timer is with a variable which decrements per 1 each second...

    EDIT:

    Ok.. related to the timer behaviour, I just found this, so it's a Chrome bug.

    Also, new version...here

  • Miyavi: Would you mind sharing a capx for your latest version? You solved some problems I'm currently dealing with.

    Thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi again, guys.

    I've been making some progresses with my game, but I'm having some problems as well.

    For example, I have some errors when I try that my enemies chase me and attack within range (as for spearman). They sometimes bug, and won't chase me at all, sometimes they will just stop (and when my action area gets off them, and then I come closer to them, they will reactivate, and so on..)

    So.. would any helping hand suggest some improvements?

    PS: I actually ran out of events, so I'm buying the standard version tomorrow :D

    Sorry it's uncommented and such, but It's a bad habit I have >.<

    If you have any problems with it, just ask me.

    Capx here

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)