zatyka's Recent Forum Activity

  • Sorry about that. The link to the Capx is fixed.

    Ancor

    Using the method in my example, you would create another instance variable in the gameitems sprite and name it something like "Destructability", and set it for each gameitem instance. Then, when picking up the item, add the "destructablility" instance variable to the Inventory array along with the the Item's other info (i.e. name and description). Now that the data is stored in the inventory array, you can do whatever you want with it.

    Look at how I'm storing the description of each item... the same principles apply to any item data you want saved.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First problem: When I'm facing left, my sword attacks to the right anyway.I already tried to use the mirror effect but nothing happen.

    This is because you're moving the sword by changing it's angle. If you set a sprite's angle to 45 degrees, it won't change angles by mirroring the sprite. If you want to swing the swrong to the left by changing the sprite's angle, you'll need to move the sprite in the opposite direction as a right facing swing.

    I think you'd be much better of creating an animation of the sword swinging rather than manipulate its angles. That way, mirroring the sprite would work, and you wouldn't have to fool around with wait commands (see 2nd issue). However, I've never messed around with sword mechanics in C2, so perhaps someone with experience can comment on which method is appropriate.

    Second problem: As you can see, it's taking too long to my sword spawn another object to collide with the enemy and kill it. And if I jump and attack at the same time, my player create spawn object at wrong positions and times. I know I have to destroy the spawn object, but I didn't yet because this problem.

    This is due to all the wait commands. You have the sword finish swining, and then a wait command of 0.5 seconds, and then the hitbox is created. Those 0.5 seconds are what is causing the delay. Spawning the hit box before the wait command is a quick fix.

    I made a few changes to your capx that that fix the issues you discussed, but it's probably worth exploring other more efficient sword mechanics.

    Capx

  • Each X cell in the array represents an item. If you want to remove (destroy) one of the items in your inventory, Delete the cell with the item you want to destroy. In my example, each X cell contains an item name. If you want to destroy the item named "cheese" from the inventory, use the action:

    Delete index (Inventory.IndexOf("Cheese")) from X Axis

    This finds the X index of the cell containing "Cheese", and deletes it. Here's a modification of my previous example:

    Demo

    Capx

    Learning how to manipulate arrays is an extremely useful skill that is definitely worth learning.

    Edit: Fixed the Capx link

  • While there are undoubtedly ways to make inventories without Arrays, they're really the best option (at least in my opinion). Here's an example I made for someone else a while back. It should show you the basics:

    Demo

    Annotated Capx

  • When you call the function, add a parameter, and set it to the platforms UID. Then in the function, use the "Pick by UID" condition, and set it to the function parameter.

    -Player: On Collision with platform

    -- Platform.trigger != 0

    -> call function "te_" & platform.trigger(Platform.UID)

    • On function "te_1"

    -Pick Platform by UID (function.param(0)

    -> platform destroy

  • ramones

    Awesome! I hadn't considered ordering a loop by a calculated expression.

  • I think you're better off avoiding the "Pick Nearest" condition in this scenario. You could probably somehow use it in conjunction with the "pick all" condition to find the nearest 4, but that seems like a really ugly solution to me.

    There could possibly be a more elegant way to do this, but this is what I came up with:

    Demo

    Annotated Capx

    It stores the distance between the hero and each enemy in an array, sorts the array to find the 4 with the shortest distance, and changes their frame.

  • You're not nesting the scroll action in the "at start of layout" condition, right? If so, it'll only fire once and not every tick.

    This works fine for me:

    <img src="http://i.imgur.com/iVpZTZk.png" border="0" />

    Edit: I just reread your post.

    then something like every 5 seconds, scroll y to current y -5

    To scroll down, you need to add to ScrollY. Subtracting will try and scroll up.

  • Just to add on to what Darklinki said. Think of the "on collision" as the very first tick that the two sprites are overlapping.

  • Yes, my screenshot used a Boolean instance variable, but you could use a regular variable as well. Think of a Boolean as a variable with only 2 possible values.... True or false. You could use a regular variable instead and use the values 0 and 1 to represent false and true.

  • You need to create it. It's an instance variable I created in the hero sprite. Check out the manual entry on instance variables. Actually, you'd probably benefit by going through some beginner tutorials to get a handle on the basics.

  • The issue is that when you already have a movementArea created off screen. Because you haven't tied the hero to a specific movement areas, he gets tied to the first one that was created (the one that's off screen). That's why he seems to disappear. Add a "Movement Area Destroy" Action at the start of layout, and a instance variable on the hero to say whether he can move or not. This worked fine:

    <img src="http://i.imgur.com/RvAxTOj.png" border="0" />

zatyka's avatar

zatyka

Member since 11 Aug, 2012

Twitter
zatyka has 1 followers

Trophy Case

  • 12-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • x11
    Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual

Progress

15/44
How to earn trophies