dop2000's Recent Forum Activity

  • Instead of conditions 5 & 6 you can change the formula to something like this:

    lerp(-0, -100, (max(abs(Enemy1.X-Player.X),400)-400)/1000)

  • You need "8Direction -> Set vector X/Y" action. How you use it depends on the game. It can be something like this:

    Player on collision with Block 
    ... Player Set vector X to (Plyer.X-Block.X)
    ... Player Set vector Y to (Plyer.Y-Block.Y)
    
  • Use FileChooser.FileNameAt(0), save it to a variable. If you need to store it between sessions, save to Local Storage.

  • This can also be done in one line of code with regex. I'm not very good with regular expressions, but this example from stackoverflow seems to work:

    if RegexSearch( FileName, "^[\w\-. ]+$", "g")<0 ...Set text "Invalid character"
    

    \w means characters [0-9 a-z A-Z _], also allowed are dash "-", dot "." and space.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good guy chadorireborn has ported MoveTo addon for C3 runtime:

    construct.net/en/forum/construct-3/plugin-sdk-10/construct-3-runtime-a-few-cons-137539

    But you are right, some effects can be very slow on mobile, even in C3 runtime. If you have many instances or objects with the same effect it's better to put them all on the same layer and apply effect to the layer.

    In my game I added an event that disables effect when FPS drops below certain number...

  • Use find(string, substring) expression. It returns -1 if the substring was not found and a number >=0 if it was found.

    So you can add several conditions like this:

    find(filename,"/")<0
    find(filename,"\")<0
    find(filename,"?")<0
    find(filename,"*")<0
    .....Set text "File name is valid"
    Else
    .....Set text "Invalid character!"
    
    
  • 2. Add event -> Audio -> Is tag playing. After that right-click this event and select "Invert". And voila - you get "Audio tag is NOT playing"!

    That's why I recommended to start with tutorials.

    As for other problems, I can't help you without seeing your project file.

  • You can add a variable PreviousMouseX=0 and do this:

    On Every tick
    Mouse.X not equal PreviousMouseX
    ....Set controlsType="kn&mouse"
    ....Set PreviousMouseX to Mouse.X
    
    
  • Self.X>Car.X?180:0 this means if camera.X>car.x, then the angle is 180, otherwise the angle is 0.

    abs(car.X-Self.X)*4*dt means absolute distance between camera and car (always positive value) multiplied by 4*dt, which is ~0.06

    So the camera sprite moves towards car sprite, and the bigger is the distance between sprites, the faster it moves.

    .

    Actually, now I realize that you don't need abs() and that formula for angle. Simply move (car.X-Self.X)*4*dt pixels at angle 0 - it will work the same.

  • Why are you doing this in such a complex and obscure way? Why not simply pick a random instance of the object and use it to spawn the projectile?

    System pick random Hyve
    ...Hyve spawn Projectile
    ...Projectile set angle of motion to 
    .. etc
    

    If you need, you can first pick instances of Hyve with IIDs 184-190 in this event. Although, hard-coding IIDs in events is a bad practice, it's better to use instance variables.

    Here is a demo I made quite a while ago for some other post, see comments in the code:

    dropbox.com/s/0jptlam49u7ugse/spawningDemo.capx

  • There shouldn't be any jerkiness with the first formula, although the correct method is to use dt: lerp(Self.X, Target.X, dt*5)

    The second formula should give you very sharp movement. At 60 fps dt value is ~0.016s, so (1-dt^0.075) gives you something around ~0.3, which means that the camera will cover 1/3 of the distance to target every tick. This is a lot, that's why this camera will follow the car almost instantly.

    You can also try something like this: lerp(Self.X, Car.X, abs(car.X-Self.X)/1000), this will give the camera slow start and slow finish. There are lots of other methods, but I don't remember them :)

    In C2 I also used MoveTo behavior for the camera instead of lerp. On every tick moving to target position with smooth acceleration and deceleration and limited maximum speed, it looked pretty good. MoveTo addon is ported to C3, so you can try it if you want.

    Here is a little demo to play with:

    dropbox.com/s/afrx680gfapj4yr/Lerping.capx

    .

    By the way, here is an excellent article explaining how cameras work in many popular game: Scroll Back: The Theory and Practice of Cameras in Side-Scrollers

  • I believe on a device without mouse, Mouse.X and Mouse.Y will always return 0.

    So you can simple check if they are not equal 0.

dop2000's avatar

dop2000

Online Now

Member since 26 May, 2016
Last online 13 Feb, 2025

Twitter
dop2000 has 259 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies