Can't figure out rotate left (counter clockwise) and timers

0 favourites
  • 3 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games. With wood, nature, & jungle theme
  • I'm trying to build a simple card game to learn Construct. I've built this in Scratch 2 already but can't figure out how to rotate the card left (counter clockwise). It moves one step then stops. I thought I could use the same setup for rotating it right (clockwise) but it doesn't work.

    I don't quite understand Timers either, from what I read, they seem like Messages in Scratch, except each Timer is independent. When I call a Timer to run the rotate-left animation, it moves one step then stops. I've also tried a Repeat loop (repeat 12 times Set Angle to -8), it steps one time then stops. My guess is I'm fundamentally misunderstanding how Construct runs the stack of events/actions. I'm thinking of it like objects that respond to calls (sort of like how Scratch uses Messages). Also misunderstanding how Timers work (more so, how actions are executed under a Timer call), and I don't think the manual does a good job of explaining how to use these functions.

    Links to my --

    C3P file: dropbox.com/s/n10ab2tlcmxfh ... e.c3p?dl=0 C3P project file (stored on Dropbox)

    Scratch project: scratch.mit.edu/projects/195088669 "basic card actions, working (buggy)- card hover, drag drop" (view in browser, requires Flash)

    • Added a GIF of the Scratch project running...

    Here's a screenshot of my event sheet (modified slightly from the c3p file), and a GIF of the project running to show the behavior.

    Event Sheet

    C3P Project running

    Scratch Project running

  • There are quite a few problems with your code:

    First, smallest frame time in C2 is about 0.016 seconds, so starting timer for 0.000005 is the same as starting it for 0.016s

    Your event #5 doesn't have any actions and will never work anyway, because angle is never equal to itself+90. Same with #7.

    On timer when the card starts rotating, you change its isTapped variable. You should do this after rotation has finished.

    Your code allows to click the card while it's still rotation.

    Your timers are running forever, even after rotation is stopped, timers continue to run.

    Here is the demo showing 3 different ways to rotate your card:

    https://www.dropbox.com/s/fyal1pkopl8rx ... s.c3p?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks a ton for those samples of how to rotate the card using different methods. I'm going to study each method until I understand how each part works and why. I really appreciate the help, dop2000. 🙌🏽

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)