dop2000's Recent Forum Activity

  • Your game looks great!

    However, it seems like it's going to be a big project and it's already quite messy. You need to get a few things right ASAP!

    1. First, start using families. I imagine wolf will not be the only enemy in your game. You don't want to duplicate hundreds of lines of your code when you add a new enemy type!

    Create families for all objects that can be logically combined - Enemies (include wolf, bear, zombie etc.), Friendlies (Player, NPC), SceneryObjects etc.

    Every time you add new events and feel like you may need to re-use them for a different object, consider creating a family.

    Note, that you can have the same object in several families.

    Say, wolves can be in Enemies family for all enemy-related things (attacking, pathfinding etc.) and in AliveObjects family (vulnerable to cold, leave blood splatter when killed etc.).

    You will need to move all instance variables and behaviors to family level. It's a time consuming task, but you need to do it now, otherwise it will take 10x more time later when your project grows bigger.

    Follow this tutorial:

    https://www.scirra.com/tutorials/535/ho ... o-a-family

    Also, if two objects are very similar (for example different types of trees), it's better to use one sprite with different animations.

    2. Use containers.

    If you add Enemy, EnemyRange, EnemyHealth to the same container, you'll only need to create an Enemy and pin EnemyRange and EnemyHealth.

    You don't need to worry about creating or destroying EnemyRange and EnemyHealth, it will be done automatically.

    You don't need to link them together using EnemyID variable. Every time you pick one object from the container, others will be picked automatically.

    For example:

    Bullet on collision with Enemy

    -> Subtract 1 from Enemy.health

    -> EnemyHealthBar set width to Enemy.health (you don't need to pick EnemyHealthBar by EnemyID)

    With families and containers you should be able to significantly optimize and de-clutter your code.

    3. Use different event sheets. 260 events in one sheet is a bit too much.

    I would definitely move all enemy AI stuff to a separate sheet.

    4. Create a new layout, name it Assets and dump all your objects to that layout. I'm talking about shadows, corpses, steps, range circles, text captions etc.

    C2 requires one instance of each object to be added to a layout, but it shouldn't necessarily be your main Game layout.

    Sorry, I didn't get to the AI part, I think you need to fix all these issues with your project first...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure, if you share the capx here or PM me, I can take a look.

  • Here is formula for positioning sprites in a circle:

    X=centerX+RADIUS*cos(angle)

    Y=centerY+RADIUS*sin(angle)

    If you change "angle" from 0 to 360, you'll have full circle.

  • Here is a demo:

    https://www.dropbox.com/s/lgjr9t2nck4b2 ... .capx?dl=0

    And another one with several different methods of spawning:

    https://www.dropbox.com/s/0jptlam49u7ug ... .capx?dl=0

  • The easiest way to do this is to put a bunch of invisible sprites - SpawnPoints.

    Then you can do something like this:

    Every 2 seconds
    Repeat round(random(10,15)) times
         System-> Pick random instance of SpawnPoint :  SpawnPoint spawn Enemy
    [/code:2v7a2cd3]
    
    This code is not very good because the same SpawnPoint may be selected several times and spawned enemies will overlap.
    A better solution would be adding Timer behavior to SpawnPoint. Each SpawnPoint instance will be running its own timer and spawning enemies on timer event. 
    You can also add a condition to check if there are other enemies within X pixels from the SpawnPoint before spawning a new enemy.
  • Try "For each" as a sub-event:

    Door overlapping Ground
        For each Ground      ....
    [/code:2olscttg]
  • Not sure if this advice will be helpful..

    In my game, which is also quite a big project, I have lots of separate event sheets for different things - Audio, Background, Enemies, Shop, Coins etc.

    Almost all of them have "Init()" function, which resets static variables, enables/disables groups and does other things like that.

    On start of each level I call these functions - BackgroundInit(), EnemiesInit() etc.

    This helps to keep things organized.

    Changing state for several hundreds of groups at once doesn't seem like a good idea.

    If you think it's the only way, you can try this:

    Make a list of all groups. (to automate this task you can search for "event-group" tag in .xml files of the project using software like Notepad+)

    On start of the game, loop through this list and save the initial state of each group in an array or dictionary.

    Then you can use this data to reset all groups to their initial state.

    Or you can include the default state into each group's name. For example "Player controls #D", where "#D" at the end means "disabled by default".

  • I made this demo for another post recently:

    https://www.dropbox.com/s/0ex32akdcl7s2 ... .capx?dl=0

    You'll need CSV plugin to open it:

    plugin-csv-csv2array-csv2dictionary_t64326

    As for the button, you can change its appearance with CSS, but I prefer using sprites.

  • Can you try this -

    Create a new empty layout, set it as first layout in project properties. Then preview your project on mobile. Will it still take 4 minutes?

  • I don't have an answer for you, just curious - how slow is it?

    My capx is 15Mb and takes about 5 seconds to load when previewing on my Android phone.

  • Put A and B on the same layer, B above A.

    Set blend mode for B to "Source in"

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 250 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x4
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies