Baked's Recent Forum Activity

  • Brilliant, that's exactly what I wanted. Thankyou :)

  • Hi,

    I want to perform some actions on touched but not when a specific object is touched.

    I can't invert the on touched object. Is there a work-around or different way to achieve this event?

    Thanks

  • game will do an alert if it can't find at least one instance in layout, so yes, you must have at least one instance of every sprite created NOT by events. I think a quite good solution would be to create a layout with all game sprites, and never go to that layout if you cannot bare having instances outside standard layouts and destroying them on start :)

    as for onCreated - well create object event triggers on created - that's obvious. already created objects are not created during the game, they are there from the beginning - that's why the oncreated doesnt trigger I think.

    hope that helps

    Yes, I use the same technique placing all objects in an unused layout.

    As for onCreated; technically the instance of the object must be created when that layout loads the objects you placed in the designer.

    Anyway, I've just joined the onCreated and layoutStart events with an 'or' as that seemed like the most elegant solution.

    Thanks again.

  • Thanks guys, I will have a look at those solutions.

    But am I the only one that thinks the object created event should be called for each object that is already in the editor?

  • Use 'on start of layout'?

    Objects can be created during gameplay as well as present at the beginning. So I would rather not duplicate actions.

    Surely it makes sense for an objects Created event to be called if it 'created' when the layout starts?

  • Is the On created event only fired when you create an object through an action? Doesn't seem to be working on objects that are already placed in the layout.

    Is there a workaround for this?

    Thanks

  • Nope this isn't really what I am looking for. Maybe you've misunderstood me.

    Think angrybirds, the way you have different types of birds in a set order for each level. Once one has been used up the next one spawns. I need something similar to that system.

    Cheers.

  • This is similar to the solution I am currently working on. The part I'm having difficulty with is deciding which object to spawn.

    Would using an array to store which objects and what order to spawn them in be the best solution here?

  • I need to spawn different types of objects in a certain order for each level.

    What type of system can I use to control this and how can I decide what type of object to spawn?

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To calculate an objects angle of motion, create 2 instance variables for the object called 'PreviousX' and PreviousY'

    at the end of your events add

    Every Tick -> Object: Set PreviousX to X

                  Object: Set PreviousY to Y

    Then to calculate the objects actual angle of motion use Angle(Object.PreviousX,Object.PreviousY,Object.X,Object.Y)

  • SOLVED

    The problem was GravityPhysics is a family behavior, so it seemed to be getting the wrong velocity values so I used superkews solution using instance variables instead of globals.

    If anyone knows how to target the correct instance of that behavior I would be very greatful.

    Cheers

  • hmmmm,

    I might have just rushed to answer your post :)

    But, remember that the point 0,0 is the top left corner of your screen. So you are continuously calculating the angle from there.

    VelocityX should be the magnitude of the velocity in that direction, as with VelocityY. Calculating an angle based on the origin (top left corner) and the magnitude of the velocity is sure to cause some strange results isn't it?

    As I understand it:

    The velocity is just a coordinate position relative to the current position. It can be negative.

    So the position of an object in the next step using velocity is just x+Vx, y+Vy. So if you calculate the angle from 0,0 using Vx and Vy is should be the correct direction?

Baked's avatar

Baked

Member since 13 Aug, 2012

None one is following Baked yet!

Trophy Case

  • 12-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies