E2GameStudios's Recent Forum Activity

  • looks very cool!

  • Ok everyone...I can find plenty of information for instance variables for objects like sprites but I finding nothing on setting an instance variable for something like a touch command.

    Here is what I am trying to do: I have a sprite object with multiple animations and I need to figure out how to have an On Touched event play one of the various animations depending on the number of touches on the associated object.

    This is probably very simple and I have just gotten so wrapped up in it that I cant see the obvious solution but at this point I could really use a hand. Honestly I am not entirely sure I even need an instance variable to do this but I have yet to find an alternative so I am open to any suggestions that will ultimately help me get the animations associated with the on touched object (or on click for that matter)to run in accordance with the number of touch/clicks.

    Thanks in advance!

  • Very excited. Count me in!

  • I run into a similar problem...in that often preview will present a layout other than the one I preview from regardless of which preview button I use (the main one at the top left or via right click on the chosen layout listed in the window in the upper left).

  • Hey silkc2. I did manage to terminate the loop (seems I lack the rep to reply to your message). I do however have a new problem I am hoping you can help with. Please check out my new post on sequential animations I could really use your clarity!

  • This would be great! And maybe an align option that does both vertical and horizontal at the same time.

  • I suppose I could do it as one large animation but doing it this way lets me have forward and backward for each segment which is vital for this project. If you know a way to code it using one large sprite where I some how designate a frame range per on-touch (either forward or backward) I would be happy to try it. ;)

  • Hey everyone.

    I have managed to figure out how to get an animation to play forward (when someone clicks on an empty sprite box on the right side of the screen) and then in reverse (When the player clicks on an alternate empty sprite box on the left). Basically, I created two separate animations within the Sprite object...I named the 1st one "forward" and then I created another animation and reversed the order of the frames so when it's run it runs the sequence in reverse which I creatively titled "reverse".

    On my event sheet I have an "on start of layout" event that stops the animation at the initial frame.

    Then I have an "on touched" event associated with the right hand empty sprite box that sets the animation to "forward" (Play from beginning) and another "On Touched" event (tied to the left hand empty sprite)that effectively plays the reverse version of the sprite object when clicked/touched.

    Now here is my problem: I have multiple Sprites (with a "Forward" and "Reverse" animation) for this layout and desperately need to figure out a way to have the the Sprites swap out in a sequential manner depending on which sprite was just played and which animation played.

    For example - The animation is for sprite A is halted on frame 1. The user clicks the right hand empty sprite object which fires off the "forward" sprite animation (of Sprite A) which after running at the designated FPS halts on the last frame. This last frame of the "Forward" animation of Sprite A is the also the first frame of the "Forward" animation associated with Sprite B so the transition is seamless but I need Sprite A to be hidden on the end of the "on clicked" and Sprite B made visible (and in a stopped state) on its initial frame. THEN when the user clicks the right hand empty sprite box again the "forward" animation of Sprite B plays and ends in an identical fashion to Sprite A which transitions seamlessly into sprite C's Forward animation when the right hand empty sprite box is clicked a 3rd time....and so on and so forth.

    Inversely, I also need the Left hand empty sprite boxes to manage the sequential playback of the "reverse" animations of each sprite depending upon which sprite is currently visible.

    I hope this makes sense and a GREATLY appreciate any help you guys can provide.

    R/s

    Elemental Entertainment LLC

  • Hey Guys...I am new to this. How do I take that code and apply it as a plugin in c2?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Silkc2

    So "0 based" simply means that the animated sequences begin with 0 rather than 1 (because when you import frames it begins with 0...then goes to 1,2,etc).    Got it.

    When you say "if statement" I assume you are referring to the condition where you have an expression that makes a comparison (of =Equal to) to a number "Self.AnimationFrameCount-1" but I am confused when you talk about offsets and checking the last frame...though I have yet to actually encounter an "if" when looking through the system or object events. However, before I dig too much into that I would like to validate my understanding on the function of the even sheet as a whole. Would I be correct in saying the Event Sheet is where the user articulates how and when the imported assets and native objects (to the program) are presented and manipulated upon the execution of the layout? And further, that terms like "if statement" or "Else" and "While" refer to the logic that allows the user to communicate to the program how and in what order those objects should be manipulated? Finally, that the code is read and executed from top to bottom unless a loop is put in that dictates the program repeat some previously dictated action?

    *That question may make it look like I know more than I am leading on but that paragraph was the end result of about 20 minutes of research, careful thought and selective phrasing but ultimately is a real set of questions as I have found that often my conclusions are only partly accurate and the component I am missing is vital to a true and accurate understanding of the topic.

    The reason I elected to request validation on those things is so that I can have the proper frame of reference for some of your other statements. For example: You say "if my sprite is on frame 2"...does that refer to where the sequence left off during the execution of the events on the event sheet or rather does that refer to where it is set to start in the properties of the sprite object under "initial frame" (or both)?

    If you failed to designate to Animationframecount-1=2 would c2 simply continue to try to add frames even though the animation (in your case) consists of a total of 3 frames? Why is it necessary to designate NOT to try to go to frames that do not exist? Or does the "Else" statement serve only to create a loop where the sequence repeats itself indefinitely upon (in this case) an ontouch event?

    Finally, when you say "hardcoding" what does that mean and what would your approach be called in programming terms? Dynamic coding? Can you provide a simple example of both methods (or refer me to an example)? Does hardcoding refer to writing a series of events/conditions/expression that facilitates a beginning to end execution of a layout independent of the nature of an object or it's relative complexity (like the number of frames in an animated sprite sequence)?

  • I think I may have found a source of information to answer my own questions:

    scirra.com/manual/44/event-sheet-view

    and

    scirra.com/manual/75/how-events-work

    I'll be sure to drop in on this thread if I am still left wanting on the specifics of my situation.

    Thanks!

  • Silkc2

    Thank you...after updating my copy of c2 (to version 121)I was able to open the capx you made for me. I was able to copy and paste the events into my project and update the reference to the animation sequence I have. After I deleted all my various attempts to set up what you have done it worked!

    However, I am hoping to understand how to set this up on my own as I would imagine community members such as yourself would grow very tired of essentially writing code for me which I turn around and adapt to my project. So if I may be so bold I would ask for some basic tutelage on these events but realizing that a nebulous "how did'ja do dat" would not reflect my aptitude or my regard for your selfless efforts on my behalf I will try to be specific:

    I see that you started the event sheet for the layout with a System Event that references the (sprite) animation and then set up an action of "Stop on load". My understanding would be that this effectively halts the animation on frame 1 until it's told to do something else and that makes sense to me. There are details about that process such as the event sheet's reference to the layout (meaning the necessity to have the sprite inside the layout if the event sheet references it) or the relationship between an event system action to stop the animation vs. setting the spite's animation speed to "0" or setting "Loop" to no that elude me but I can probably figure that out own my own through trial and error.

    Where I am quite lost is when we begin with the on-touched action: Here the on-touch event is tied to the sprite object (the animation) then somehow you have what I believe to be called an expression (correct me if I am wrong) tied to the sprite animation BUT nestled within the On-touch event. My experimentation would indicate that this a "condition" added to the event via right clicking on the event. I say "indicate" because often what I have concluded about the logic in c2 is not correct. *I am confident that is a reflection of my total lack of programming experience rather than any error on the part of the fine makers of the product. Anyway, within this condition you have an expression that makes a comparison (of =Equal to) to a number "Self.AnimationFrameCount-1" followed by a conditional system else that appears to dictate that the frame number be set to "Self.AnimationFrame+1" and THAT Sir (or Ma'am) blows my mind .

    The problem is that I wouldn't have known A) to set up the conditions inside the event B) to reference the sprite in that condition or C) how to formulate the syntax used for the number fields.

    Maybe the logic I am struggling with here is covered in some undiscovered tutorial or is simply a reflection of everyone else's experience with coding in general but I am anxious to understand how you knew to set that string of Action/events. If I can grasp and employ that information then I can probably work out how to do some more complex things with my project such as having the sequence stop...letting another sequence be run within the layout (using the same ontouch logic)...and once that sequence is finished having the original sequence continue to completion (effectively ending the layout and redirecting the user to another layout).

    I sincerely appreciate any additional time you spend enlightening me on this even if it is only to point me in the direction of a tutorial that covers the logic behind the event sheet.

    Respectfully,

    Matthew

E2GameStudios's avatar

E2GameStudios

Member since 4 Mar, 2013

None one is following E2GameStudios yet!

Connect with E2GameStudios

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies