Animated Projectiles Demo

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Hutchboy
Posts: 51
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

Animated Projectiles Demo

Post by Hutchboy » Sat Feb 10, 2024 5:23 am

Hi,
Attached is a small stack illustrating animating projectiles without too many bells and whistles. For this implementation I just concentrated on what I could do with graphic objects and the various properties you can set for them. It is should be fairly easy to tweak this as you see fit.

There is another tutorial breakdown of a defender-like game on this forum, "Defensive-Release", which is quite a large project and contains projectile animation. For my purposes I thought I would just tackle projectile animation from scratch and build up to include other effects. One thing I would like to do is to be able to tilt the PacMac-like character up and down and have the projectiles be emitted in the new direction. Maybe a scale scrollbar would work or, preferably an on-screen simulated trackball.

Back when I took the Galactic Gauntlet course I tried to get rays shooting out of the rocket but never got very far. It seems this basic effect is the key to many kinds of games. Hope this helps in some way.

[Note: replaced demo with new version in new post below.]

Happy Coding,
-Mike
Attachments
Projectiles Demo.png
Projectiles Demo.png (46.65 KiB) Viewed 786 times
Last edited by Hutchboy on Sun Feb 11, 2024 10:30 pm, edited 2 times in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Animated Projectiles Demo

Post by dunbarx » Sat Feb 10, 2024 5:58 pm

Hi.

A minor point. On a laptop where it is possible to simply tap the mousePad instead of clicking on it, "Bob" open its mouth but no bullet emerges.

How do you modify the shot angle? All mine went out horizontally.

Craig

Hutchboy
Posts: 51
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

Re: Animated Projectiles Demo

Post by Hutchboy » Sun Feb 11, 2024 4:33 am

Hi,

I’ll test it on my laptop and see if I can get that working correctly. I haven’t implemented the angular change yet although I have the head tilting up and down with a scroll bar while maintaining the mouth animation. Thanks for the feedback.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Animated Projectiles Demo

Post by stam » Sun Feb 11, 2024 11:06 am

This highlights the main limitation of LiveCode - very poor frame rate with multiple animated objects (at least on my system running LC 10 DP7, macOS Sonoma 14.3, on an M2 Pro MBP). Using the fire button continuously and especially making the window wider, the frame rate can drop to around 3-5 FPS.

This is more or less what I expect from LC and don't think it can much be improved by coding. Being an nterpreted rather than compiled language, and limited to single core, I wouldn't really advise using LC for games or animated projects with > 5-6 animated objects. It can never achieve the high frame rates of compiled languages and is not the right tool for that job.

It is one of the areas I believed 'script compilation' would benefit, but as yet this is still vapourware... maybe one day!

faber3d
Posts: 29
Joined: Sat Nov 16, 2013 6:51 am

Re: Animated Projectiles Demo

Post by faber3d » Sun Feb 11, 2024 4:58 pm

I've been creating minigames for years with no problem in Livecode.... The slowness of their games is because they are not well planned, which makes the code uncoordinated, Each command and variable wants to function in its own way without thinking that it is a piece of a global structure......Another factor that I have seen in the examples is that they use inappropriate commands, although they work, in the general structure of the game they cause hierarchical conflict.

In the sheep game made for mobile devices I use 8 moving Gifs.
Image

--- > Video Example movement of various objects in Livecode...!

.
Attachments
Sheep_Ovejas.jpg
Last edited by faber3d on Sun Feb 11, 2024 7:55 pm, edited 1 time in total.

faber3d
Posts: 29
Joined: Sat Nov 16, 2013 6:51 am

Re: Animated Projectiles Demo

Post by faber3d » Sun Feb 11, 2024 5:52 pm

I know what I'm about to say is going to cause controversy, but I recommend not using the funtion "Repeat" in a main command of the game..... Actually some examples and tutorials need to be rewritten with a simple coding to avoid a bad functionality in games. :roll:

Hutchboy
Posts: 51
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

Re: Animated Projectiles Demo

Post by Hutchboy » Sun Feb 11, 2024 10:26 pm

Hi,

I've updated my demo to include rotating the direction of fire with a scrollbar. I also added a function to control opening and closing of "Bob's" mouth to align with the firing angle.

I still have to see what might be happening with the trackpad not working. I've searched the forums but have only found reference to touch screens.

- Mike
Attachments
MGB Animated Projectiles Demo.livecode.zip
(185.58 KiB) Downloaded 25 times

faber3d
Posts: 29
Joined: Sat Nov 16, 2013 6:51 am

Re: Animated Projectiles Demo

Post by faber3d » Mon Feb 12, 2024 2:15 am

Pressing the start button several times increases the firing speed. ¿..?.!!

Is important to hide some buttons. Image

Post Reply

Return to “Games”