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.

Newcomers AppGameKit Corner / scaling multiple sprites individually pseudo 3D effect

Author
Message
tasmanian guy
14
Years of Service
User Offline
Joined: 29th Jun 2010
Location: Australia
Posted: 3rd Jul 2015 15:06 Edited at: 4th Jul 2015 11:15
Hi everyone,

I'm trying to create multiple planes (up to 10 at once) to be coming out of the screen at you as try and shoot them down (I want to keep this 2D for simplicity).

I have created a type called enemyplanetype as below. The xoffset is the value of the x coordinate of the sprite, the yoffset is the y coordinate of the sprite and the scale is the amount of scaling to be applied to that particular sprite.

type enemyplanetype
xoffset as float
yoffset as float
scale as float
endtype
rem we setup a maximum of 10 planes through a dimensional arrray
global dim enemyplane[10] as enemyplanetype

I have created the sprites and position them on the screen by using a counter and can move them individually giving each one a random x and y coordinate starting point, but I just can't seem to figure out the command to scale the sprite within the array.

I know the command is setscalesprite(id,xscale,yscale) but how do you utilise it in this context?

Any help greatly appreciated. Thanks!

DBPro is the new Amos (I hope)
tasmanian guy
14
Years of Service
User Offline
Joined: 29th Jun 2010
Location: Australia
Posted: 5th Jul 2015 16:16
Okay I think I've got it working. Just doing a single sprite at the moment before I chuck in some for next loops for testing purposes. It works...but I need to make it scale slower



thanks again!

DBPro is the new Amos (I hope)
tasmanian guy
14
Years of Service
User Offline
Joined: 29th Jun 2010
Location: Australia
Posted: 5th Jul 2015 16:59
Well after a bit more playing I've got it.



I'm not too sure if that is the most economical way to do it but it works.

Happy for some feedback

DBPro is the new Amos (I hope)

Login to post a reply

Server time is: 2024-11-23 22:11:03
Your offset time is: 2024-11-23 22:11:03