Animated Projectiles Demo
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Animated Projectiles Demo
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
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 (46.65 KiB) Viewed 988 times
Last edited by Hutchboy on Sun Feb 11, 2024 10:30 pm, edited 2 times in total.
Mike Roberts
https://mygiantbrain.com
https://mygiantbrain.com
-
- VIP Livecode Opensource Backer
- Posts: 9731
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Animated Projectiles Demo
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
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
Re: Animated Projectiles Demo
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.
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.
Mike Roberts
https://mygiantbrain.com
https://mygiantbrain.com
Re: Animated Projectiles Demo
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!
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!
Re: Animated Projectiles Demo
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.
--- > Video Example movement of various objects in Livecode...!
.
In the sheep game made for mobile devices I use 8 moving Gifs.
--- > Video Example movement of various objects in Livecode...!
.
Last edited by faber3d on Sun Feb 11, 2024 7:55 pm, edited 1 time in total.
Re: Animated Projectiles Demo
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.
Re: Animated Projectiles Demo
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
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 30 times
Mike Roberts
https://mygiantbrain.com
https://mygiantbrain.com
Re: Animated Projectiles Demo
Pressing the start button several times increases the firing speed. ¿..?.!!
Is important to hide some buttons.
Is important to hide some buttons.