Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Sprite commands help Set Position using mouse/pointer

Author
Message
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 23rd Jan 2015 20:41
Hi,

well I am stuck again and can't quite seem to get my routine working well if anyone can help.

I am using Sprites for a colour palette and am trying to get them to scroll up and down the screen using the speed of the mouse. I nearly have it but they are not quite lining up if you could see what I am doing wrong.

The code is below and I have attached the media folder with this post.

Hope this makes sense if you run the code you will see what I am trying to do. I think?

Thanks.



Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C & C++ / now also AGK2! Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga. Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles

Attachments

Login to view attachments
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 23rd Jan 2015 23:13 Edited at: 23rd Jan 2015 23:13
Nice color selector

Just change this line:
moveColSprite = GetSpriteY ( colButton [numColours] ) + GetSpriteHeight ( colButton [i] )

to:
moveColSprite = GetSpriteY ( colButton [numColours] ) + GetSpriteHeight ( colButton [i] )- colSpeed


AND

This line:
moveColSprite = GetSpriteY ( colButton [i+1] ) - GetSpriteHeight( colButton [i] )

to:
moveColSprite = GetSpriteY ( colButton [i+1] ) - GetSpriteHeight( colButton [i] )+ colSpeed


This change make sure that the mouse diff is also taking into account when you swap around the sprites, and they will line up evenly.

Should fix your problem.

best regards Preben Eriksen,
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Jan 2015 03:22
Hi there, thanks for the advice. I will check this out tomorrow.

Glad you like the idea of the colour selector. I have not fully implemented it yet because I got stuck here but and I have got to say I am not sure how I am going to do it yet but my idea is to use the 14 sprites that scroll to be able to select between around 120 colours. I was thinking that the 14 sprites will scroll but will change between 120 images.
So where I have 14 images I will have 120 but only use 14 sprites.
Thought this might save memory but also without trying it I am not sure how practical having 120 images loaded in will work. I also intend to redraw the colour images to make them look better when I get it all working
If I can't do it I might try using plain sprites and changing the colour value of the sprite instead of loading more images so will only use 14 sprites and images and then there is no need to draw the images I can just create filled in boxes but not sure how slow this will be yet.
Hmmmmm get this working tomorrow first though lol

Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C & C++ / now also AGK2! Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga. Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Jan 2015 20:15
Well I changed the code with the suggestion from Preben which when I looked you was right as I had missed putting the colSpeed on, however I am still having trouble with it.

If you move the point slowly it will work most of the time, however if you move the mouse fast or move the colours up and down while still holding the mouse it proper messes up!

I have been looking and looking but can't seem to find my error in the code, I must have something wrong with how I am reading the pointer or something, really not sure.

Can anyone help?

Cheers.



Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C & C++ / now also AGK2! Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga. Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Jan 2015 20:56
Well I might have cracked it!

I put the colour sprite positions into a float array instead of chnging the position of the sprite directly and then moved the positioning of the sprite to the main loop where the pointer is placed.

Works well on my tablet so will just check 100% but seems pretty good to me lol




Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C & C++ / now also AGK2! Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga. Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 24th Jan 2015 21:13
Here again,

for those that want to see the working code then here it is perfected with the scrolling colours but not expanded yet for over 100 colours lol.

I have added a max speed for the colour sprites to move and it now works great.

If you want to see this going further with more colours etc then check out the tutorial and Colour Splash project post here:

http://forum.thegamecreators.com/?m=forum_view&t=213305&b=48

Buy for now




Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C & C++ / now also AGK2! Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga. Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles

Login to post a reply

Server time is: 2024-04-25 13:57:05
Your offset time is: 2024-04-25 13:57:05