CrossBread's Recent Forum Activity

  • Link to .capx file (required!):

    capx

    Steps to reproduce:

    1. Run preview

    2. Move player under blue box with arrow keys

    3. Shoot (space) blue box

    Observed result:<img src="http://crossbreadtech.com/imageserver/UncaughtRangeError.png" border="0">

    Expected result:

    The reason this occurs is because Event 11 uses On created to create an object of the same type. (The bubble spawner should have spawned a bubble instead of another spawner.) This is obviously incorrect, but the error message is only slightly less cryptic than "Stack overflow". If possible it would be nice to catch this, prevent the next object from being created, show the user an error pop-up, but not crash the game.

    It's obviously a bug that the game dev would need to address, but it renders the game unusable at that point and could be quite difficult to track down from the error text provided.

    Browsers affected:

    Chrome: yes

    Firefox: untested

    Internet Explorer: untested

    Operating system & service pack:

    Win 7 Ultimate SP1

    Construct 2 version:

    R152 64-bit

  • I'm thinking you are overcomplicating things a bit.

    Couldn't you just have the direction the object is moving on collision determin the imagepoint to connect to?

    I'll give that a shot and see if it works any better. The idea was to be able to expand to pieces that aren't a single block and might have more than one slot on each side. Like Tetris pieces or something. Your suggestion may at least get my game playable for the game jam though.

    Also using buildable and buildableother is confusing me, but that might be a personal issue.

    As for the family usage, I was trying to follow the pattern discussed in this tutorial: Understanding picking with respect to families

    <center>

    <img src="https://www.scirra.com/images/articles/assetlist.png" border="0">

    [Image from tutorial example]

    </center>

    But instead of Buildable_1 and Buildable_2 my families are named Buildable and BuildableOther, since Collision in some other engines allows you to refer to the two objects involved as "self" and "other". I've really had trouble wrapping my mind around C2's very indirect way of referring to a specific instance. I think the best description I found suggested to think of it like writing SQL instead of OO code like Java. This families approach seemed to be the simplest I've run across that didn't involve pinning ghost copies to everything which seemed like more of a hack.

  • I'm designing a game (my first in Construct 2!) for Ludum Dare 28 where the central element is that the player can add parts they salvage onto their vehicle. I've tried two different approaches now, and the current one is more clean and takes advantage of families, but it still doesn't work completely.

    The intended behavior is:

    1) When player collides with armor, mount (pin) the armor to the player (directly under it).

    2) When armor collides with other Armor, snap/align the other armor and pin to existing armor.

    3) [not implemented] When armor collides with a cannon, pin the cannon directly on top of the armor. (Same for anything else in the Mountable family)

    <img src="http://crossbreadtech.com/imageserver/pin-and-collision-events.png" border="0">

    Right now #1 works. For some reason, the collision between two armors only works for the first layer (adjacent to the player, and armor it's mounted to.) Even then it inconsistently snaps to the wrong (not nearest) image point. Also the first collision seems to be ignored, but on a second pass it picks up the block.

    I'm pretty stumped and have been staring at this literally all day, read tutorials, the manual, googled, etc. Learned a fair amount, but I still can't figure out what the problem is here.

    pin-and-collision.capx

    The green squares are spawned on top of any non-zero image points of the armor so that I can use pick nearest. They store the image point they were spawned on so that I can then move the new part to that location and pin it to the player.

    The Buildable and BuildableOther families are mainly to facilitate performing specific actions on the two armor sprites when they collide.

    Another element of the game is that you have to fight yourself (Pressing R should build a copy of you) although I'm pretty sure that's broken after I ripped out my first attempt. To do this, I was recording the type and X/Y distance from the Player for every part added in 3 arrays, type, X, and Y.

    The problem with this is that if the player was turned sideways, the coords could be off, so reconstructing the clone didn't work unless I locked down the player's freedom to rotate. I had considered using relative polar coordinates instead, capturing angle relative to the player, distance, and type. But if there is a better way to do this I'd love to hear it.

    Here's the live version if you want to see what I'm talking about.

    I'm super impressed with how helpful this community is, so thanks in advance!

  • Ok, that seems to work now. Thanks!

    I was just reversing the process from before. It didn't occur to me to re-save as a single file. Still not sure why unzipping and re-zipping should break the ability to read the file, but whatever so long as there's a workflow that works.

  • zenox98

    Well, it looks like I spoke too soon. I can open the project fine from the .caproj file when unzipped, but once I bundle it back up, C2 still crashes. (With or without the plugin installed.)

    I'm just using 7-zip to zip it. ZipCrypto, not AES method.

    Any thoughts? Or is it fine to just post a link to the .zip in my post and let people unzip and open the .caproj? Not really sure what the etiquette around the community.

  • Ok, I think I figured it out. I started from scratch with a copy of my current .capx. Looks like there was a global reference down near the end of the file too.

            <global-instance type="ChromeConsole" uid="19" />

    I tested opening again with the plugin uninstalled after removing what you suggested and everything seems clean.

    Thanks for the help! <img src="smileys/smiley32.gif" border="0" align="middle" /> Now I can go post a topic about the real issue, lol.

  • Thanks for the quick reply. <img src="smileys/smiley4.gif" border="0" align="middle">

    So, here's what I did:

    1. Renamed the .capx to .zip

    2. Unzipped and opened the .caproj in the root dir and found the following:

    <used-plugins>

            <plugin author="Scirra" id="Arr" version="1">Array</plugin>

    ...

    3. I deleted the line containing the Chrome Console plugin.

    4. Zipped the root dir

    5. Renamed .zip to .capx

    I tested out opening this file with the plugin uninstalled, but now C2 crashes on startup. <img src="smileys/smiley11.gif" border="0" align="middle">

    Here's the file in case it's just my install for some reason:

    pin-and-collision.capx

    So... will C2 ignore any events, etc. from the plugin because it's missing, or could it possibly be crashing due to a Chrome Console log event left on the sheet?

  • I've got a problem in my game I could really use help with, but I've installed the Chrome Console plugin which is preventing my .capx from being easily opened when shared.

    I tried deleting all the Chrome Console actions, but the file still can't be opened. I tried removing the plugin from the directory, but now I can't open my file either, which makes sense I guess. <img src="smileys/smiley5.gif" border="0" align="middle" />

    So, is there a way to "clean" the file after using addons so that someone else can open it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • player on collision with part:

    -slot destroy

    -part destroy

    -player spawn part at imagepoint

    -part pin to player

    It WORKED!!! <img src="smileys/smiley32.gif" border="0" align="middle" /> Thank you, I've been fighting with that for half the day. When I started I didn't realize there was a "Spawn at image point" action (since I was looking for something with "create"). The only modification it required was storing the image point index on the Slot object and then referencing that to spawn the part just before destroying it.

    I also tested enabling the solid behavior of the parts again and that works fine. I do have the collision detection boxes set 2-3 px smaller than than my 16x16 Part size though.

    So, for anyone's future reference:

    On Player Create:

    • Loop over image points
    • Spawn "Slot" sprite for collision detection at each one
    • Store corresponding image point on the Slot

    On Slot collision with Part:

    • Destroy Part
    • Spawn Part at image point (use point stored in Slot)
    • Destroy Slot
    • Pin Part to Player
  • Thanks for the quick reply! <img src="smileys/smiley4.gif" border="0" align="middle" /> I'll give that a shot. The slots were just there to facilitate the alignment and detecting a part.

    Sorry about the bad .capx. I deleted all the usage of the chrome logging thinking that would remove the conflicts. If your suggestion doesn't resolve the issue, I'll figure out how to downgrade so I can post the file.

  • I'm using Construct 2 for the first time for the Ludum Dare 28 competition. I looked through the FAQ and searched the forum but I didn't find something that looked similar, although I may just not have the experience to recognize my solution yet.

    In my game, the player can collect parts that will snap to open slots. I did this by creating objects at 4 image points outside the player, then checking for collision between parts and those "slot" objects.

    On collision I set the part position to match the slot (they're the same size) and then immediately pin the part to the player and destroy the slot. However, I end up with weird offset with each part. For example, instead of being exactly 16 pixels away on the X axis from the player, I see values like 13.9023999. It's different every time, regardless of the speed the player is traveling when the collision occurs.

    It mainly just looked bad until I added the solid behavior to the parts and player (which I think I need to keep the enemy from passing through), but now, understandably it drives the player off the screen trying to stop overlapping the sprite pinned to it.

    .capx

    Any suggestion for a better technique for avoiding the overlap would be greatly appreciated.

  • Here is one solution, I don't see why it wouldn't work with families as well:

    https://dl.dropboxusercontent.com/u/19921470/evil_sprites_demo.capx

    Evil sprites example

    You could save variable values from picked instance into local variable, and compare those to variables of other instance. Then react accordingly.

    Thanks! That evil sprite demo showed exactly what I was looking for! <img src="smileys/smiley4.gif" border="0" align="middle" /> I've just started experimenting with C2, so I didn't know I could grab the UID and use pick instance in that way.

CrossBread's avatar

CrossBread

Member since 10 Nov, 2013

None one is following CrossBread yet!

Connect with CrossBread

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies